sysadmin
System administration tasks
-
mkfs
Tested mkfs examples: making an ext4 filesystem, setting a label and UUID, choosing block and inode counts, and checks before formatting.
-
mount
Tested mount examples: attaching a filesystem by device, label or UUID, reading the options in force, bind mounts, fstab, and busy unmounts.
-
passwd
Tested passwd examples: setting a password from a script, reading the status line, what a locked password does not stop, and expiring an account instead.
-
ps
Tested ps examples: aux versus -ef, choosing columns with -o, selecting by user or name, sorting, the process tree, and pgrep instead of grep.
-
rsync
Tested rsync examples: the trailing-slash rule, dry runs, itemised output, --delete, exclude patterns, hard links and --link-dest snapshots.
-
ss
Tested ss examples: listing listening sockets, finding the process holding a port, filtering by state and address, and reading the queue columns.
-
sudo
Tested sudo and su examples: running one command as root, what the environment loses on the way, the redirect that still runs as you, and reading sudoers.
-
systemctl
Tested systemctl examples: starting and stopping services, enabling them at boot, reading unit state, drop-in overrides, and diagnosing failures.
-
tail
Tested tail examples: -n and -c, the +N form that counts from the start, following a growing file with -f, and why log rotation needs -F instead.
-
top
Tested top examples: the summary lines, the process columns, sorting and filtering in batch mode, threads, and reading a process's memory and CPU.
-
File permissions explained
The rwx/owner-group-other model, numeric vs symbolic chmod, umask, and why setuid/setgid on directories behave differently than you'd expect.
-
Processes and signals
How processes are born, orphaned and reaped, what a signal actually does, why kill -9 is a last resort, and why Ctrl-C stops a whole pipeline at once.
-
Add a directory to your PATH permanently
How to put a directory on PATH for good on Debian, why ~/.local/bin needs no configuration at all, and what to do for any other directory.
-
Find and replace across many files
Replace a string across a directory tree with grep -rl and sed -i, safely for filenames containing spaces, with a dry run and a backup first.
-
Find files without the permission denied noise
Why 2>/dev/null is the wrong fix for find's permission denied errors, and what -readable -prune does instead, including what happens to the exit status.
-
Keep a program running after you log out
How to stop a long job dying when an ssh session ends, what each approach really does about SIGHUP, and an honest recommendation between them.
-
Find and kill whatever is using a port
Identify the process bound to a TCP port that's refusing to let a service start, then stop it.
-
Monitor a log file in real time
Watch a log file as new lines are written, filter it live, and keep watching across log rotation.
-
apt update failed
apt update reports a failure, exits 0 and carries on with an index fetched days ago. How to read the transcript and find the repository that broke.
-
command not found
The shell says this for a command that is missing, one that is not on PATH, one it remembers in the wrong place, and a script whose interpreter is gone.
-
Could not get lock /var/lib/dpkg/lock-frontend
apt refuses to run because something else is already installing. Modern apt tells you exactly which process, and deleting the lock file is the wrong fix.
-
No space left on device
A write failed for want of space. Find which filesystem is full, whether it ran out of blocks or inodes, and why deleting the big file often frees no space.
-
Package installation failed
apt install stops before dpkg runs. Telling a package apt has never heard of from one it cannot download, and why --fix-missing is rarely the answer.
-
The following packages have been kept back
apt-get upgrade refuses to install new packages, so an upgrade that needs one is held back instead. What the message means and the three things that cause it.