This is a searchable Bash and GNU coreutils cheatsheet. Each entry shows the command’s synopsis, its most useful flags and a working one-liner example, so you can recall the exact syntax for everyday tasks without leaving the page. It covers shell builtins, file and directory tools, and the text-processing utilities you reach for in pipelines.
How it works
The reference splits commands into groups. Builtins such as cd, export, alias and source are part of bash itself and act on the shell’s own state. Coreutils such as ls, cp, grep, sed and sort are standalone programs on your $PATH. A handful of common tools like tar, ps and df round out a working shell session. Search matches against the command name, its synopsis, the description and the example, so you can look up a name you remember (grep) or a task you want (permissions, archive, count lines).
Tips and power patterns
Commands compose through pipes: grep -rn 'TODO' src/ | wc -l counts every TODO in a tree. Quote globs you want find to expand rather than the shell, as in find . -name '*.tmp'. Prefer chmod 755 (octal) for a quick mode set, and chmod u+x (symbolic) when you only want to flip one bit. For destructive commands like rm -rf, double-check the path first — there is no undo. For the full option list of any command, run man <cmd> or <cmd> --help.
The most useful one-liners to remember
# Find files modified in the last 7 days
find . -name '*.log' -mtime -7
# Replace text in files in-place (GNU sed)
sed -i 's/old/new/g' file.txt
# Sort unique, count occurrences, show top 10
sort file.txt | uniq -c | sort -rn | head -10
# Follow a log live as it grows
tail -f /var/log/app.log
# Check which process holds a port
lsof -i :8080
# Run a command and time it
time ls -la /usr/lib
# Compress a directory
tar -czf archive.tar.gz /path/to/dir
# Extract a tar.gz
tar -xzf archive.tar.gz
Builtin vs external command: why it matters
A handful of shell builtins have the same name as external programs. cd is always a builtin; there is no /usr/bin/cd. echo exists both as a builtin and as /bin/echo, with slightly different behavior on some flags. When you use which cmd or type cmd, you can see which version the shell will run. In scripts, this distinction matters most for portability: a builtin is always available regardless of what is in $PATH, but external tools may not be present on minimal systems or containers.
How to search efficiently in this reference
Type the name of a command you already know to recall its flags. Type a task word like permissions, compress, pattern, or replace to discover the command that handles it. Type a flag like -r or --recursive to see which commands support it. The search matches on the command name, its description, and the included examples, so you can approach it from whichever direction you know best. Everything here runs in your browser; nothing is uploaded.