πŸ“š Learning Hub
Β· 2 min read

8 Terminal Commands That Will Make You Look Like a Wizard


These aren’t obscure commands nobody uses. These are the ones that make people say β€œwait, how did you do that?β€œ

1. !! β€” Repeat the last command

apt install [nginx](/blog/nginx-config-generator/)
# Permission denied

sudo !!
# Runs: sudo apt install nginx

!! expands to your last command. sudo !! is the most useful two-word combination in terminal history.

2. ctrl+r β€” Search command history

Press ctrl+r and start typing. It searches your entire command history. Press ctrl+r again to cycle through matches.

Looking for that Docker command you ran last Tuesday? ctrl+r then type docker β€” it’s there.

3. xargs β€” Turn output into arguments

# Delete all .log files
find . -name "*.log" | xargs rm

# Kill all node processes
ps aux | grep node | awk '{print $2}' | xargs kill

# Download a list of URLs
cat urls.txt | xargs -I {} curl -O {}

4. watch β€” Repeat a command every N seconds

# Monitor disk usage every 2 seconds
watch -n 2 df -h

# Watch pods restart in real-time
watch kubectl get pods

# Monitor a log file's line count
watch wc -l /var/log/app.log

Like a live dashboard in your terminal.

5. column -t β€” Align output into columns

# Messy output:
cat data.csv
name,age,city
alice,30,brussels
bob,25,amsterdam

# Clean output:
cat data.csv | column -t -s ','
name    age  city
alice   30   brussels
bob     25   amsterdam

6. tee β€” Write to file AND stdout

# Save output to file while still seeing it
npm run build 2>&1 | tee build.log

# Append to file
echo "new entry" | tee -a log.txt

Perfect for logging a command’s output without losing the live view.

7. rsync β€” Smart file copying

# Copy files to server (only changed files, with progress)
rsync -avz --progress ./dist/ user@server:/var/www/app/

# Local backup with progress
rsync -avh --progress ~/projects/ /backup/projects/

Unlike scp, rsync only transfers changed bytes. Resumable, fast, and shows progress.

8. jq β€” Parse JSON like a pro

# Pretty-print JSON
curl api.example.com | jq .

# Extract specific fields
curl api.example.com/users | jq '.[].name'

# Filter
curl api.example.com/users | jq '.[] | select(.age > 25)'

# Count items
curl api.example.com/users | jq length

Bonus: Key combos most people don’t know

  • ctrl+a β€” Jump to start of line
  • ctrl+e β€” Jump to end of line
  • ctrl+w β€” Delete word before cursor
  • ctrl+u β€” Delete entire line before cursor
  • ctrl+k β€” Delete from cursor to end of line
  • alt+. β€” Insert last argument of previous command

These work in bash, zsh, and most terminals. Learn them once, use them forever.

Related: Bash Cheat Sheet β€” the complete reference for everything bash.