Home › Templates › Linux & Mac terminal

🖥️ Linux and macOS terminal commands cheat sheet you can copy

The same few shell commands come up again and again, and the flags are easy to forget. This pack keeps the useful versions in one place for Linux and macOS.

Replace the [brackets] before you run anything, and double check any command that deletes or overwrites. Save the pack to CopyCat to paste them in a click.

Find files by name

find [.] -type f -name "[*.log]" 2>/dev/null

Search text in a project

grep -rn "[text]" [.] --include="[*.js]" --exclude-dir=node_modules

Disk usage: biggest folders

du -h -d 1 [.] | sort -hr | head -15

Free disk space

df -h

Which process uses a port

lsof -i :[3000]

Kill a process on a port

kill -9 $(lsof -t -i :[3000])

Tail a log

tail -n 100 -f [path/to/app.log]

Make a file executable

chmod +x [script.sh]

Create or extract archives

tar -czf [archive.tar.gz] [folder]/ tar -xzf [archive.tar.gz]

Quick API request

curl -s -X POST "[https://api.example.com/path]" -H "Content-Type: application/json" -H "Authorization: Bearer [token]" -d '{"key": "value"}'

SSH with a key

ssh -i [~/.ssh/id_ed25519] [user]@[host]

Watch a command repeat

watch -n 2 "[command]"

More template packs

Stop retyping these

Add the whole "Linux & Mac terminal" pack to CopyCat in one click and edit anything you like.

Add this pack