| Command | Description |
|---|---|
pwd |
Print current directory (where am I?) |
cd <folder> |
Change directory |
mkdir <name> |
Create a new folder |
rm <file> |
Delete a file (permanent!) |
rm -r <folder> |
Delete a folder and its contents |
cp <src> <dest> |
Copy a file |
cp -r <src> <dest> |
Copy a folder and its contents |
mv <src> <dest> |
Move or rename a file/folder |
touch <file> |
Create an empty file |
chmod +x <file> |
Make a file executable (run as script) |
which <command> |
Show where a command lives |
du -sh <folder> |
Show folder size (human-readable) |
df -h |
Show disk space usage |
grep "text" <file> |
Search for text inside a file |
grep -r "text" <folder> |
Search for text in all files in a folder |
find . -name "*.pdf" |
Find files by name pattern |
head -20 <file> |
Show first 20 lines of a file |
tail -20 <file> |
Show last 20 lines of a file |
wc -l <file> |
Count lines in a file |
open <file> |
Open file with default macOS app |
open . |
Open current folder in Finder |
clear |
Clear the terminal screen |
history |
Show your command history |
sudo <command> |
Run a command as admin (asks for password) |
Use Tab to autocomplete and โ to recall previous commands!