I've been using Linux for years. These 15 commands are in my muscle memory — I use all of them daily.
Not just the commands, but how and why they work, so you can adapt them.
1. grep with context
# Just match
grep "error" app.log
# With 3 lines before and after (gives context)
grep -C 3 "error" app.log
# Recursive in directory
grep -r "TODO" ./src
# Count matches per file
grep -rc "console.log" ./src
# Case insensitive + show line numbers
grep -in "warning" app.log
Why it matters: Finding errors in logs without context is useless. -C 3 changes everything.
2. find with actions
# Find and delete old files
find /tmp -type f -mtime +7 -delete
# Find and execute a command
find . -name "*.log" -exec gzip {} \;
# Find by size
find . -type f -size +100M
# Find by permissions
find . -type f -perm 777
3. awk for quick data extraction
# Print second column
awk '{print $2}' file.txt
# Sum a column
awk '{sum += $3} END {print sum}' data.csv
# Print lines where column 2 > 100
awk '$2 > 100' data.csv
# Process CSV
awk -F',' '{print $1, $3}' data.csv
4. sed for quick edits
# Replace in file (in-place)
sed -i 's/localhost/production.server.com/g' config.txt
# Delete lines matching pattern
sed -i '/^#/d' config.txt
# Print specific lines
sed -n '10,20p' large-file.txt
5. tmux for persistent sessions
# New named session
tmux new -s work
# Detach (keep running)
Ctrl+B, then D
# List sessions
tmux ls
# Reattach
tmux attach -t work
# Split pane horizontally
Ctrl+B, then "
# Split pane vertically
Ctrl+B, then %
Why it matters: SSH drops? Your work is still running. tmux is essential for remote servers.
6. rsync for safe file sync
# Sync local to remote (dry run first!)
rsync -avzn ~/projects/ user@server:/backup/
# Actually sync
rsync -avz --delete ~/projects/ user@server:/backup/
# Sync with progress
rsync -avz --progress ~/big-folder/ /backup/
7. watch for monitoring
# Run a command every 2 seconds
watch -n 2 'df -h'
# Watch for changes
watch -d 'ls -la /tmp'
# Monitor disk usage
watch -n 5 'du -sh /var/log/*'
8. jq for JSON processing
# Pretty print
curl -s api.example.com/data | jq .
# Extract field
curl -s api.example.com/users | jq '.[].name'
# Filter array
curl -s api.example.com/users | jq '.[] | select(.active == true)'
# Transform
curl -s api.example.com/users | jq '[.[] | {id, name}]'
9. Process substitution
# Compare outputs without temp files
diff <(sort file1.txt) <(sort file2.txt)
# Pass command output as file to another command
wc -l <(grep "error" app.log)
10. xargs for bulk operations
# Kill processes by name
pgrep node | xargs kill
# Delete files from a list
cat files-to-delete.txt | xargs rm
# Run command for each line in parallel
cat urls.txt | xargs -P 4 -I {} curl -O {}
11. Brace expansion
# Create multiple files at once
touch test{1,2,3,4,5}.txt
# Create nested directories
mkdir -p project/{src,tests,docs}/{components,utils}
# Backup a file
cp config.json{,.bak}
12. !! and !$
# Repeat last command with sudo
sudo !!
# Use last argument of previous command
ls /var/log/
cat !$ # cat /var/log/
13. Process management
# Run in background
command &
# Bring back to foreground
fg
# List background jobs
jobs
# Run immune to hangup (survives SSH disconnect)
nohup command &
# Check what's using a port
lsof -i :8080
14. History tricks
# Search history
history | grep docker
# Ctrl+R interactive search
# Type partial command, keep pressing Ctrl+R to cycle
# Run specific history number
!42
# Print last N commands
history 10
15. curl for API testing
# GET with timing
curl -w "\nTime: %{time_total}s" https://api.example.com/health
# POST JSON
curl -X POST \
-H "Content-Type: application/json" \
-d '{"key": "value"}' \
https://api.example.com/data
# Save response
curl -o response.json https://api.example.com/data
# Follow redirects + show headers
curl -Li https://example.com
Cheat sheet bookmark
I built a one-page terminal cheat sheet with these commands. Check DevToolkit for 31 browser tools including a regex tester and diff viewer.
What command am I missing from your daily workflow? Drop it in the comments.
Top comments (0)