Commands
Command references with practical, copy-pasteable examples.
Debian packages
-
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.
-
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.
-
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.
Text processing
-
cat
Tested cat examples: joining rotated logs, numbering lines with -n and -b, and using cat -A to find the carriage returns stopping a script from running.
-
less
Tested less examples: the keys that move and search, why a piped less turns into cat, and how lesspipe lets it open a compressed file directly.
-
grep
Tested grep examples: recursive search, regex flavours, context lines, counting, scripting, and more.
-
sed
Tested sed examples: substitution, addressing, deletion, in-place editing, and multi-command scripts.
-
awk
Tested awk examples: fields and records, patterns, BEGIN/END, arrays, printf, and practical one-liners.
-
jq
Tested jq examples: picking values out of nested JSON, filtering with select, reshaping objects, and getting raw strings back out into a shell script.
-
sort
Tested sort examples: numeric vs lexicographic order, sorting by field with -k, human-readable sizes with -h, and checking whether a file is already sorted.
-
uniq
Tested uniq examples: why input must be sorted first, counting occurrences with -c, and isolating only the duplicates or only the singles.
-
cut
Tested cut examples: selecting fields with -f, character ranges with -c, custom delimiters, and the gotchas that push you toward awk instead.
-
tr
Tested tr examples: case conversion, deleting or squeezing character sets, the [^...] mistake, and real text-cleanup pipelines.
-
head
Tested head examples: -n and -c, multiple files and their headers, the -n -N form that drops the last lines, and stopping a pipeline early.
-
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.
-
wc
Tested wc examples: -l/-w/-c/-m, multi-file totals, the no-trailing-newline gotcha that undercounts lines, and pairing with grep for non-blank counts.
-
diff
Tested diff examples: unified and context formats, directory comparison, ignoring whitespace or case, and generating a patch file with patch to apply it.
-
tee
Tested tee examples: saving a pipeline's output while still seeing it, appending with -a, and the sudo tee trick for writing files your shell cannot.
-
cowsay
Tested cowsay examples: piping output into it, the wrapping rules that catch people out, cowfiles and how to write one, and why -f on a download runs code.
Files & directories
-
ls
Tested ls examples: the long format column by column, hidden files, sorting by time and size, symlinks, time styles, and why piped output looks different.
-
cd
Tested cd examples: why no program could do this job, what cd - and $OLDPWD hold, and the two different answers cd .. gives under a symlink.
-
find
Tested find examples: name and type filters, size and age, permissions, -exec vs -delete, and safe scripting patterns.
-
cp
Tested cp examples: copying files and whole trees, why a second cp -r nests the directory inside itself, and what -a preserves that a plain copy loses.
-
mv
Tested mv examples: renaming and moving files, why a second mv nests a directory inside itself, and what changes once the destination is another filesystem.
-
rm
Tested rm examples: -r and -rf, why a directory's permissions decide what you may delete, and three ways a command removes more than the files you named.
-
mkdir
Tested mkdir examples: the two separate things -p does, why an existing file still fails it, and why -m never reaches the parents it invents.
-
ln
Tested ln examples: why a symlink's target is resolved from the link's own directory, what a hard link shares, and the -n that stops a relink landing inside.
-
touch
Tested touch examples: creating a file without truncating an existing one, setting access and modification times separately, and the timestamp nothing can set.
-
du
Tested du examples: -sh totals, --max-depth, apparent size versus allocated blocks, sparse files, hard links, excludes, and sorting the output.
-
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.
Getting help
Archives & compression
Processes & system
-
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.
-
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.
-
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.
-
systemctl
Tested systemctl examples: starting and stopping services, enabling them at boot, reading unit state, drop-in overrides, and diagnosing failures.
-
journalctl
Tested journalctl examples: filtering by unit, priority and time, following logs live, output formats, and controlling journal disk usage.
Networking & transfer
-
curl
Tested curl examples: GET/POST/PUT/DELETE, headers, auth, cookies, uploads, redirects, retries, and scripting.
-
wget
Tested wget examples: downloading, resuming, retries, authentication, recursive mirroring, and scripting with exit codes.
-
ssh
Tested ssh examples: key-based auth, the config file, host key verification, port forwarding, multiplexing, and reading a failed connection.
-
ss
Tested ss examples: listing listening sockets, finding the process holding a port, filtering by state and address, and reading the queue columns.
Users & permissions
-
chmod
Tested chmod examples: numeric and symbolic modes, recursive changes, setuid/setgid/sticky bits, permission audits, and troubleshooting.
-
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.
-
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.
Shell & automation
-
which
Tested which examples: how PATH order decides the answer, the shell script Debian ships in place of the GNU program, and the deprecation that was reversed.
-
xargs
Tested xargs examples: batching with -n, placeholders with -I, NUL-separated input from find -print0, parallel runs with -P, and what its exit codes mean.
-
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.
Nothing on this page matches that. Try the site search for everything else.