files
Working with files and directories
-
blkid
Tested blkid examples: reading a filesystem's UUID, label and type, single-value output for scripts, searching by tag, and probing past the cache.
-
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.
-
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.
-
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.
-
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.
-
dd
Tested dd examples: making disk images, choosing a block size, seek and skip, conv=notrunc, sparse files, and why the output argument is the dangerous one.
-
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.
-
diff
Tested diff examples: unified and context formats, directory comparison, ignoring whitespace or case, and generating a patch file with patch to apply it.
-
du
Tested du examples: -sh totals, --max-depth, apparent size versus allocated blocks, sparse files, hard links, excludes, and sorting the output.
-
find
Tested find examples: name and type filters, size and age, permissions, -exec vs -delete, and safe scripting patterns.
-
fsck
Tested fsck examples: checking without repairing, forcing a check past the clean flag, reading the exit status, and repairing a damaged filesystem.
-
fuser
Tested fuser examples: which processes hold a file, what is keeping a filesystem busy, reading the access letters, and killing the holders with -k.
-
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.
-
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.
-
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.
-
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.
-
lsof
Tested lsof examples: what has a file open, which process holds a port, finding a deleted file that is still using disk space, and narrowing the output.
-
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.
-
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.
-
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.
-
rsync
Tested rsync examples: the trailing-slash rule, dry runs, itemised output, --delete, exclude patterns, hard links and --link-dest snapshots.