A fast lookup for the commands used most often on these servers. Each section has
a fuller page linked for depth — this page is just the "I need the command now"
reference.
Files & Navigation
Command
Description
ls -lah
List all files, long format, human-readable sizes
cd -
Jump back to the previous directory
pwd
Print current directory
cp -r src dst
Copy recursively
mv src dst
Move / rename
rm -rf dir
Delete recursively (careful)
mkdir -p a/b/c
Create nested directories
ln -s target link
Create a symlink
tree -L 2
Directory tree, 2 levels deep
stat file
Size, permissions, timestamps
readlink -f file
Resolve to absolute/real path
Viewing & Searching Text
Command
Description
cat / bat
Print a file (bat = syntax-highlighted)
less file
Page through a file (q to quit)
head -n 20 / tail -n 20
First / last 20 lines
tail -f file
Follow a file live
grep -rin "text" .
Recursive, case-insensitive search with line numbers
# Biggest 10 items in the current directory
du-sh*|sort-rh|head-n10# Free up disk: what's using space under /var
sudodu-xh/var|sort-rh|head-n20# Follow a service and grep at the same time
journalctl-fudocker|grep-ierror
# Find and delete files older than 30 days
find/path-typef-mtime+30-delete
# Replace text across files (in place)
grep-rl"old".|xargssed-i's/old/new/g'# Quick HTTP server for the current directory
python3-mhttp.server8000# Show the 10 largest files under a path
find/path-typef-printf'%s %p\n'|sort-rn|head|numfmt--field=1--to=iec