September 10, 2026 · Yunus Emre Vurgun

Unix File Commands Cheat Sheet

unix · cli · reference · 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

CommandWhat it doesExample
lsList directory contentsls -la /home
findSearch for files in directory hierarchyfind . -name "*.php"
grepSearch text using patternsgrep -r "function" src/
awkPattern scanning and processing languageawk '{print $1}' file.txt
sedStream editor for filtering and transforming textsed 's/old/new/g' file.txt
tarArchive filestar -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.