Linux / Arch / CachyOS
CachyOS & Linux
cheat sheet.
From installing packages to finding a stubborn process. Everyday commands for your Linux system, in one place.
- Commands
- 120
- Categories
- 10
Pacman
sudo pacman -SyuSynchronize repositories and upgrade all packages (full system update).
sudo pacman -S <package>Install a package from the official repositories.
sudo pacman -R <package>Remove a package but keep its dependencies.
sudo pacman -Rs <package>Remove a package and its unused dependencies.
sudo pacman -Rns <package>Caution: Remove a package, its unused dependencies, and config files.
pacman -Ss <keyword>Search for a package in the remote repositories.
pacman -Qs <keyword>Search among locally installed packages.
pacman -Qi <package>Display detailed information about an installed package.
pacman -Si <package>Display detailed information about a remote package.
pacman -Ql <package>List all files installed by a package.
pacman -Qo /path/to/fileFind out which package owns a specific file.
pacman -QdtList all orphaned packages (installed as dependencies, no longer needed).
sudo pacman -Rns $(pacman -Qdtq)Caution: Remove all orphaned packages and their config files.
sudo pacman -ScRemove old packages from the package cache.
sudo pacman -SccCaution: Remove all cached packages from the cache directory.
sudo pacman -U <package.pkg.tar.zst>Install a package from a local file.
sudo pacman -SyCaution: Refresh the package database without upgrading. Avoid using this alone: later installs can cause unsupported partial upgrades. Use sudo pacman -Syu for normal updates.
pacman -QuList all packages with available upgrades.
pacman -QeList all explicitly installed packages with their versions. Use pacman -Qqe for package names only when backing up your package list.
AUR (paru / yay)
paru -SyuUpdate all packages including AUR packages with paru.
paru -S <package>Install a package from the AUR or official repos with paru.
paru -Ss <keyword>Search for a package in AUR and official repositories.
paru --fm nano -S <package>Install from AUR and open PKGBUILD in nano before building.
yay -SyuUpdate all packages including AUR packages with yay.
yay -S <package>Install a package from the AUR or official repos with yay.
yay -Ss <keyword>Search AUR and official repos for a package.
paru -Gc <package>View AUR comments for a package (paru only).
yay --devel -SyuUpdates AUR git-based packages (those ending in -git) to their latest commit.
File System
ls -laList all files (including hidden) with detailed permissions and metadata.
cd /path/to/dirChange the current working directory.
pwdPrint the full path of the current working directory.
mkdir -p /path/to/dirCreate a directory and all parent directories as needed.
cp -r source destCopy a file or directory recursively to the destination.
mv source destMove or rename a file or directory.
rm -rf /pathCaution: Forcefully remove a file or directory and all its contents. Irreversible!
touch filenameCreate an empty file or update the timestamp of an existing one.
ln -s /target /linkCreate a symbolic link pointing to the target.
tree -L 2Show the directory structure as a tree, 2 levels deep.
du -sh /pathShow total disk usage of a directory in human-readable form.
df -hShow disk space usage of all mounted filesystems.
System & Hardware
uname -aPrint all system information: kernel, hostname, OS, architecture.
hostnamectlShow system hostname, kernel, OS, and architecture details.
lscpuDisplay detailed CPU architecture and core information.
free -hShow RAM and swap usage in human-readable format.
lsblkList all block devices (disks and partitions) with their mount points.
lspciList all PCI devices (GPU, network cards, etc.).
lsusbList all USB devices currently connected to the system.
inxi -FxzDisplay a full, detailed hardware and software system summary.
sudo dmesg | tail -50Show the last 50 kernel log messages (useful for hardware debugging).
rebootCaution: Reboot the system immediately.
sudo systemctl poweroffCaution: Shut down and power off the system.
timedatectlShow or set the system time, date, and timezone.
Process Management
htopInteractive process viewer — shows CPU, RAM usage per process.
ps auxList all currently running processes with user, PID, CPU/RAM.
ps aux | grep <process>Search for a running process by name.
kill -9 <PID>Caution: Forcefully terminate a process by its PID. Use with caution!
killall <process>Caution: Kill all running instances of a process by name.
systemctl status <service>Check the status of a systemd service.
sudo systemctl start <service>Start a systemd service.
sudo systemctl stop <service>Stop a running systemd service.
sudo systemctl restart <service>Restart a systemd service.
sudo systemctl enable --now <service>Enable a service to start at boot and start it immediately.
sudo systemctl disable <service>Disable a service from starting at boot.
journalctl -xeShow the most recent systemd journal logs with explanations.
journalctl -u <service> -fFollow live log output of a specific systemd service.
Network
ip aShow all network interfaces and their IP addresses.
ip rDisplay the IP routing table (shows default gateway etc.).
ping -c 4 <host>Send 4 ICMP packets to a host to test connectivity.
curl -I https://example.comFetch and display HTTP response headers from a URL.
wget https://example.com/fileDownload a file from the internet.
ss -tulnpShow all listening TCP/UDP ports with associated processes.
nmcli device wifi listList all available Wi-Fi networks.
nmcli device wifi connect <SSID> password <PASS>Connect to a Wi-Fi network using NetworkManager CLI.
traceroute <host>Trace the network path (hops) to a remote host.
dig <domain>Query DNS records for a domain.
ssh <user>@<host>Connect to a remote host via SSH.
scp <file> <user>@<host>:/remote/pathSecurely copy a file to a remote host over SSH.
Users & Permissions
chmod 755 fileSet file permissions to rwxr-xr-x (owner: rwx, group/others: r-x).
chmod -R 755 /dirRecursively change permissions of all files in a directory.
chown <user>:<group> fileChange the owner and group of a file or directory.
sudo chown -R <user>:<group> /dirCaution: Recursively change owner and group of a directory.
whoamiPrint the current logged-in username.
id <user>Show UID, GID, and all group memberships for a user.
sudo useradd -m -G wheel <username>Create a new user with a home directory and add them to the wheel (sudo) group.
sudo passwd <username>Change the password of a user.
sudo usermod -aG <group> <user>Add a user to a supplementary group without removing existing groups.
sudo visudoCaution: Safely edit the /etc/sudoers file to manage sudo privileges.
Text & Search
cat filePrint the contents of a file to the terminal.
less fileView a file with scrolling support (q to quit, / to search).
grep -r 'pattern' /pathRecursively search for a text pattern in all files under a path.
grep -rn 'pattern' /pathRecursively search and show matching line numbers.
find /path -name 'filename'Find files matching a name pattern under a given path.
find /path -type f -mtime -7Find all files modified in the last 7 days.
sed -i 's/old/new/g' fileReplace all occurrences of 'old' with 'new' in a file in-place.
awk '{print $1}' filePrint the first column/field from each line of a file.
tail -f /var/log/fileContinuously follow and display new lines appended to a log file.
head -n 20 filePrint the first 20 lines of a file.
sort file | uniq -c | sort -rnCount and sort unique occurrences of lines in a file.
wc -l fileCount the number of lines in a file.
CachyOS Specific
cachyos-helloOpen the CachyOS Hello welcome app for post-install setup.
sudo pacman -S linux-cachyosInstall the default CachyOS optimized kernel.
sudo pacman -S linux-cachyos-boreInstall the CachyOS kernel with the BORE scheduler for desktop responsiveness.
sudo pacman -S linux-cachyos-eevdfInstall the CachyOS kernel with the EEVDF scheduler.
sudo pacman -S cachyos-settingsInstall CachyOS system settings/tweaks for performance optimization.
sudo cachyos-rate-mirrorsAutomatically rate and select the fastest CachyOS mirrors.
sudo rate-mirrors --allow-root --protocol https arch | sudo tee /etc/pacman.d/mirrorlistRate Arch mirrors by speed and write the sorted list to mirrorlist.
sudo mkinitcpio -PRegenerate all initramfs images (required after kernel/hook changes).
sudo grub-mkconfig -o /boot/grub/grub.cfgRegenerate the GRUB configuration file (e.g., after kernel change).
sudo bootctl updateUpdate the systemd-boot EFI bootloader.
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governorCheck the current CPU frequency scaling governor.
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governorSet all CPU cores to 'performance' governor for maximum speed.
sudo systemctl enable --now ananicy-cppEnable and start ananicy-cpp for automatic process priority management.
sudo systemctl enable --now irqbalanceEnable IRQ balancing across CPU cores for better performance.
Archives & Compression
tar -czvf archive.tar.gz /pathCreate a gzip-compressed tar archive from a directory or file.
tar -xzvf archive.tar.gzExtract a gzip-compressed tar archive in the current directory.
tar -xzvf archive.tar.gz -C /destExtract a tar archive into a specific destination directory.
tar -cJvf archive.tar.xz /pathCreate a highly-compressed XZ tar archive.
zip -r archive.zip /pathCreate a ZIP archive from a file or directory.
unzip archive.zip -d /destExtract a ZIP archive to a destination directory.
7z x archive.7zExtract a 7-Zip archive in the current directory.