September 10, 2026 · Yunus Emre Vurgun
Unix File Commands Cheat Sheet
Six commands handle most file work on a Unix terminal: list, find, search inside, transform, and archive. Memorize these six with one example each and you will reach for the mouse far less.
The six commands
| Command | What it does | Example |
|---|---|---|
ls | List directory contents | ls -la /home |
find | Search for files in directory hierarchy | find . -name "*.php" |
grep | Search text using patterns | grep -r "function" src/ |
awk | Pattern scanning and processing language | awk '{print $1}' file.txt |
sed | Stream editor for filtering and transforming text | sed 's/old/new/g' file.txt |
tar | Archive files | tar -czf archive.tar.gz folder/ |
How they compose
These commands are designed to pipe into each other: find locates files, grep searches inside them, awk extracts columns, sed rewrites lines, and tar bundles the result. A typical chain — find every PHP file mentioning a function, print the filenames — is one line, not a script. When the chain needs branching or state, promote it to a script; the Shell Scripting Guide covers that step.
Fetch it as data
This sheet is the File Operations dataset. Agents that generate shell commands can validate against it instead of improvising flags:
curl "https://yjtoon.com/api/dataset/file-operations?format=toon"For deeper text processing, see AWK Reference, sed Reference, and Unix Text Processing Commands.