Utility Empire

Bash & CLI - Quick Reference

Navigation, files, text processing, processes, networking and shell tricks for everyday terminal work. All rows are plain text - search to filter, click Copy to grab the pattern.

Reference rack
STATUSREADY
ROWS52
NETWORKLOCAL
MODEREFERENCE
Item / patternWhat it means / how to use it
pwdPrint the working directory.
ls -laList everything, including hidden files, with details.
cd ~ / cd -Home directory / previous directory.
cp -r src/ dst/Copy recursively (folders and contents).
mv file dir/Move or rename.
rm -rf dirDelete a folder and everything in it - read the path twice before running.
mkdir -p a/b/cCreate nested directories in one call.
touch fileCreate an empty file or refresh its mtime.
cat filePrint a file to stdout.
less filePaged viewer with /search; press q to quit.
head -n 20 / tail -n 20 / tail -fFirst 20 lines / last 20 lines / follow a growing log.
find . -name "*.js"Recursively find files by name pattern.
du -sh dir / df -hDirectory size / disk free space.
grep pattern filePrint matching lines; add -ri for recursive and case-insensitive.
grep -v / -l / -cInvert matches / list file names / count matches.
| (pipe)Chain commands: stdout of one feeds stdin of the next.
> file / >> fileRedirect stdout - overwrite / append.
2>&1Merge stderr into stdout.
sort / sort -rnSort lines / sort numerically, descending.
uniq / uniq -cDrop adjacent duplicates / prefix each with its count.
cut -d"," -f1Split on a delimiter and print field 1.
sed "s/old/new/g" fileStreaming text replacement.
awk "{print $1, $3}"Per-line field extraction and scripting.
wc -l fileCount lines, words, and bytes.
tr "a-z" "A-Z"Translate ranges of characters.
ps aux | grep nameFind a process by name.
kill PID / kill -9 PIDGraceful terminate / force kill.
top / htopLive process monitor.
jobs / fg / bgManage background jobs.
cmd &Run a command in the background.
nohup cmd &Run detached, immune to hangup.
crontab -eEdit your scheduled jobs.
chmod +x script.shMake a script executable; chmod 644/755 for the numeric forms.
chown user:group fileChange file ownership.
env / export VAR=valShow / set environment variables.
echo $VARPrint a variable's value.
curl -s https://api.example.comFetch a URL; -o saves to a file, -H adds headers.
curl -I urlHeaders only.
wget urlDownload; -r makes it recursive.
ping host / traceroute hostICMP reachability / the route a packet takes.
ss -tlnp / netstatListening TCP ports and the process that owns them.
nc host portA raw TCP connection test.
ssh user@hostSecure shell login.
scp file user@host:/pathSecure file copy.
!! / !$Repeat the last command / its last argument.
Ctrl+RReverse-search shell history.
set -e / set -u in scriptsExit on any error / error on any unset variable.
[[ -f file ]] && echo yesQuick file tests with short-circuit operators.
source file / . fileRun a script in the current shell so its exports persist.
xargs -n1 cmdFeed stdin items to a command as arguments.
tar -czf out.tgz dir / tar -xzf out.tgzCreate / extract a gzipped archive.
unzip file.zipExtract a zip archive.