sysadmin
System administration tasks
-
apt
Search, install, remove and upgrade packages with apt, including how to see what it will do before it does it, and which commands are safe in a script.
-
apt-cache
Search the package cache, read a package's record, follow its dependencies, and use policy to see which version apt would install and from where.
-
apt-file
Tested apt-file examples: searching Debian's file index for a command you have not installed, and the substring trap in a plain pattern.
-
chown
Tested chown examples: setting owner and group, -R over a tree, why a glob misses the dotfiles, and the reason you cannot give away a file you own.
-
crontab
Tested crontab examples: schedule syntax, @reboot/@daily shortcuts, per-user crontabs, and the PATH gotcha that breaks jobs that work fine in your shell.
-
df
Tested df examples: reading the output, asking about the filesystem a path is on, choosing columns and units, and the full disk that still reports free space.
-
dpkg
Query what's installed, find which package owns a file, inspect a .deb before trusting it, and repair a half-finished install: the layer beneath apt.
-
du
Tested du examples: -sh totals, --max-depth, apparent size versus allocated blocks, sparse files, hard links, excludes, and sorting the output.
-
job control
Tested jobs, fg, bg, disown and nohup examples: the jobs table, job specs like %1, suspending and resuming, and why none of it works in a script.
-
journalctl
Tested journalctl examples: filtering by unit, priority and time, following logs live, output formats, and controlling journal disk usage.
-
kill
Tested kill, pkill and killall examples: choosing a signal, why -9 is a last resort, matching by name or command line, and signalling a whole process group.
-
man
Tested man and apropos examples: what the section numbers mean, searching by description, finding which package shipped a page, and reading a synopsis.
-
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.
-
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.
-
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.