Chapter 11 — Command reference

Quick tables for the commands used throughout the manual. READ-ONLY rows are safe to run anywhere; MUTATING rows change the host; [root] rows need privilege. Citations point to the authoritative man page or project documentation. Exact option sets are version-dependent — confirm against the installed man page.

Orientation and shell

CommandClassPurpose
cat /etc/os-releaseREAD-ONLYDistribution/release identity (os-release(5))
id; getent passwd NAME; getent group GROUPREAD-ONLYIdentity and NSS lookup (getent(1))
pwd, ls -la, cd -- /path, command -v tool, type toolREAD-ONLYNavigation/discovery (POSIX)
find . -type f -exec command {} +READ-ONLY/executeFilename-safe iteration (POSIX find)
printf '%s\n' ... | sudo tee /etc/fileMUTATING · [root]Privileged write (redirection trap workaround) (Sudo manual)

Permissions, users, sudo

CommandClassPurpose
ls -ld -- path; stat -- path; namei -l path; getfacl -p path; findmnt -T pathREAD-ONLYPermission chain inspection (getfacl(1))
chmod u+rw,o-rwx file; chmod 0640 file; umask 027MUTATINGMode changes; umask affects new files only (GNU Coreutils: chmod)
chgrp project /srv/project && chmod 2770 /srv/projectMUTATINGShared-directory setgid pattern (GNU Coreutils: setgid)
setfacl -m u:alice:rw file; setfacl -m d:g:project:rwx /srv/projectMUTATINGACL entries (setfacl(1))
useradd --create-home alice; usermod -aG GROUP USER; id aliceMUTATING · [root]Account + supplementary group (note -a) (useradd(8); usermod(8))
sudo -l; sudo -v; sudoedit FILEREAD-ONLY/EDITPrivilege inspection and safe editing (Sudo manual)
visudo -f /etc/sudoers.d/NAME; visudo -cMUTATING · [root]Validated sudoers editing (visudo(8))

Packages (per family)

CommandClassPurpose
apt list --upgradable; apt show/policy P; apt-get -s install PREAD-ONLYInspect/simulate (apt(8))
sudo apt updateMUTATING · [root]Refresh indexes only (Debian Reference)
sudo apt install/remove PMUTATING · [root]Transactions; review removals (Ubuntu: Package management)
dnf info P; dnf repoquery --whatprovides /path; dnf history list/info IDREAD-ONLYInspect/audit (DNF Command Reference)
sudo dnf install/remove P; sudo dnf upgradeMUTATING · [root]Transactions; check-update exits 100/0/1 (DNF Command Reference)
pacman -Ss/-Qi/-Ql/-QoREAD-ONLYQuery (Arch) (ArchWiki: pacman)
sudo pacman -S P; sudo pacman -SyuMUTATING · [root]Install; full system upgrade only (ArchWiki: System maintenance)

systemd, processes, logs

CommandClassPurpose
ps -p 1 -o comm=; systemctl --versionREAD-ONLYInit-system detection (systemctl(1))
systemctl status/cat/show UNIT; list-units --type=service --allREAD-ONLYUnit inspection (systemctl(1))
systemctl start/stop/enable/disable [--now] UNITMUTATINGRuntime vs boot state (systemd.service(5))
systemctl restart UNIT vs systemctl reload UNITMUTATINGRestart vs application config reload (systemd.service(5))
sudo systemctl daemon-reloadMUTATING · [root]Reread unit definitions after edits (systemd.unit(5))
systemctl edit UNIT; systemctl cat UNITEDIT/READ-ONLYDrop-ins and merged config (systemctl(1))
systemctl list-timers --all; systemd-analyze calendar 'SPEC'READ-ONLYTimer inspection/validation [systemd] (systemd.timer(5))
journalctl -b; -u NAME -b; --since '1 hour ago'; -p warning..alert; -k -b -1READ-ONLYJournal queries (journalctl(1))
journalctl --disk-usage; --vacuum-time=/--vacuum-size=READ-ONLY / HIGH-RISKInspect / delete archived journals (journalctl(1))
ps -eo ... --sort=-%cpu; pgrep -a; pstree -ap; top; free -h; vmstat 1; uptime; nprocREAD-ONLYProcess/resource inventory (ps(1); loadavg)

Networking, firewall, TLS

CommandClassPurpose
ip -br address; ip route get DEST; ip rule; ip route show table allREAD-ONLYAddresses/routes/policy (ip(8); ip-route(8))
getent ahosts NAME vs dig [@RESOLVER] [+tcp] NAMEREAD-ONLYNSS path vs raw DNS (getent(1); dig(1))
ss -lntupREAD-ONLY (attribution: [root])Listeners and binds (ss(8))
resolvectl status; readlink -f /etc/resolv.confREAD-ONLYResolver ownership (resolvectl)
sudo firewall-cmd --state/--get-active-zones/--zone=Z --list-allREAD-ONLY · [root]firewalld inspection (firewall-cmd)
sudo nft list ruleset; sudo nft -c -f FILEREAD-ONLY / validatenftables inspection/validation (nft(8))
sudo ufw status verboseREAD-ONLY · [root]UFW inspection (Ubuntu: Firewall)
sudo sshd -t; sudo sshd -T [-C spec]validate · [root]sshd syntax/effective config (sshd(8))
openssl s_client -connect IP:PORT -servername HOST -verify_hostname HOST -verify_return_error -showcertsREAD-ONLYTLS identity check (OpenSSL s_client; RFC 9525)
sudo tcpdump -ni any "host IP and tcp port PORT"READ-ONLY · [root]Packet-path evidence (tcpdump(8))

Storage, backup, monitoring

CommandClassPurpose
lsblk -o ...; blkid; `findmnt [--target--fstab--verify]`READ-ONLYDevice/mount identity (lsblk(8); findmnt(8))
pvs; vgs; lvs -a -o +devices; cat /proc/mdstat; mdadm --detail /dev/mdX; cryptsetup status NAME; cryptsetup luksDump DEVREAD-ONLY · [root]LVM/RAID/LUKS inventory (LVM2; mdadm(8); cryptsetup(8))
df -hT /path; df -ih /path; du -xhd1 /path [GNU]; du --inodes [GNU]READ-ONLYCapacity, both axes (df(1); du(1))
restic snapshots; restic ls SNAP; restic check [--read-data[--subset]]READ-ONLYBackup verification (restic)
restic restore SNAP --target DIR [--dry-run -vv] [--include ...]MUTATING (restore)Restore; preview deletions with --dry-run -vv (restic restore)
systemctl --failed; journalctl -b -p warning..alert; iostat -xz 1 [sysstat]READ-ONLYFirst-pass health (journalctl(1); sysstat)