"The terminal is like a Swiss Army knife that only a few know how to use properly - or even know about" - Me, just now

Born in 1995 I was joking that "aah those kids from 1998 don't even know what a video cassette is" - they will grow up entirely on DVDs. Turns out more technology entered the room. "Digital Native" does not equate to digital literate, which came even more clear to me when reading Kids can't use computers... and this is why it should worry you from 2013.
Recently I saw someone watching an instagram reel in the supermarket, to on the fly grab the ingredients - without noting them down in a more structured way, possibly offline way in between. Of course she had to watch the video multiple times. At first I was stunned how this was her way to do it - but after all I did the same things in different life domains. Contextually looking up fragments of information only to forget about them after using them.
This motivated me, to write more things down - and start a repository for grandmas family recipes - more precisely a spellbook for my most frequently, yet often forgotten Terminal commands.
The Philosophy: Sometimes the Best UI is No UI
When I was 11 years old, my neighbor and mentor in becoming a developer told me something that stuck with me forever: "User interface isn't that interesting - get your stuff running in the terminal first." I went the UX direction and learned: Terminals are also user interface - and sometimes indeed this - with keyboard-first navigation and clear guidance is better than some shiny UI.
Think about it: when you need to convert 100 video files, do you really want to drag each one into a GUI application? Or would you rather write one command that handles them all? When you need to find all files containing a specific text, do you want to open a file explorer and search manually, or just run grep -r "searchterm" .?
The terminal isn't just a tool - it's a philosophy. It's about efficiency, automation, and getting things done without unnecessary complexity.
My Terminal Journey: From ChatGPT to macOS Shortcuts
Here's my little secret: I ask ChatGPT for terminal commands more often than I'd like to admit. Need to convert a video to WebM with blur filter at 200% speed? ChatGPT. Want to find all files modified in the last 24 hours? ChatGPT. Trying to remember that one ffmpeg command that worked last time? You guessed it - ChatGPT.
But here's the thing: when I find myself asking for the same command three times, I know it's time to make it a macOS shortcut. Because life is too short to remember ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libopus output.webm every single time.
If it grows beyond the single command, I will add it to my central repo for scripts (everything from linux server admin to local automations like my Hacker News article to EPUB/ Kindle pipeline).
The Essential Arsenal
File System Navigation & Discovery
| Command | What it does | Fun Fact |
|---|---|---|
ls -la | List all files (including hidden) | The -la flags are like saying "show me everything, even the stuff you're hiding from me" |
du -sh * | Show disk usage of all folders | Perfect for finding out which folder is eating up your precious SSD space |
find . -name "*.pdf" -mtime -7 | Find PDFs modified in last 7 days | The digital equivalent of "where did I put that file I was working on yesterday?" |
tree | Show directory structure as a tree | Install with brew install tree - because sometimes you need to see the forest AND the trees |
The "What's Taking Up Space?" Investigation
Ever heard of MacCleaner? Yea, no fancy UI needed to find heavy files and folders.
# Find the 10 largest files in current directory
find . -type f -exec ls -la {} \; | sort -k5 -nr | head -10
# Find the 10 largest directories
du -sh * | sort -hr | head -10
# The nuclear option - find everything over 100MB
find . -type f -size +100M -exec ls -lh {} \;
Pro tip: Run these in your Downloads folder and prepare to be horrified by what you've been hoarding.
Package Management with Homebrew
| Command | What it does | Fun Fact |
|---|---|---|
brew update && brew upgrade | Update everything | The "set it and forget it" approach to keeping your system current |
brew list | Show all installed packages | Like checking your fridge to see what you actually bought |
brew cleanup | Remove old versions | The digital Marie Kondo - does it spark joy? No? Delete it! |
brew doctor | Diagnose Homebrew issues | The WebMD of package management - usually tells you to restart your computer |
Text Editor Showdown: Nano vs Vim
Nano - The Friendly Editor
nano filename.txt
Shortcuts to remember:
Ctrl + O- Save (O as in "Output")Ctrl + X- Exit (X as in "eXit")Ctrl + K- Cut line (K as in "Kill")Ctrl + U- Paste (U as in "Undo" the cut)
Fun fact: Nano shows you the shortcuts at the bottom of the screen because it knows you'll forget them. It's like the friend who always reminds you of their name.
Vim - The Editor That Makes You Feel Smart
vim filename.txt
The Vim Survival Guide:
i- Enter insert mode (i as in "insert")Esc- Exit insert mode:w- Save (w as in "write"):q- Quit (q as in "quit"):wq- Save and quit (wq as in "write and quit"):q!- Quit without saving (q! as in "quit and I don't care about your warnings")
Vim is like learning to drive a manual transmission - initially frustrating, but once you get it, you feel like a wizard. Also, you'll never be able to use regular text editors again. (But somehow the people I know who were overly obsessed with vim already in high school now work for FAANG).
Docker Management for the Lazy
People are always surprised when I tell them I use Docker. "But you're a designer. You don't need to know about that. Well I could run everything on Vercel with one button click. But I don't want to. I want to know what's going on under the hood. For instance, sometimes when stuff isn't that optimized, cache builds up and makes my VPS run out of space. Life is debugging - and so is operating a Linux server. Knowing how to run a server is like being able to fix your own car or stuff at home.
Container Investigation
# Show running containers
docker ps
# Show ALL containers (including stopped ones)
docker ps -a
# Show container resource usage
docker stats
# Find the biggest containers
docker system df -v
The "Clean Up Your Mess" Commands
# Remove all stopped containers
docker container prune
# Remove all unused images
docker image prune
# Nuclear option - remove everything unused
docker system prune -a
Pro tip: Run docker system prune -a when your disk is full and you're desperate. It's like spring cleaning for your computer.
Video Conversion
# Convert to WebM
ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libopus output.webm
# Convert to WebM with gaussian blur filter
ffmpeg -i input.mp4 -vf "gblur=sigma=20" -c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libopus output.webm
# Convert to MP4 with compression (crf lower means better quality, higher, 30+ but lower file size)
ffmpeg -i input.mov -c:v libx264 -crf 23 -preset medium -c:a aac output.mp4
# Extract audio only
ffmpeg -i video.mp4 -vn -acodec copy audio.aac
File Management
# Find and delete all .DS_Store files (macOS cleanup)
find . -name ".DS_Store" -delete
# Count lines of code in a project
find . -name "*.js" -o -name "*.py" -o -name "*.md" | xargs wc -l
# NextJS Count lines of code in a project
find . \
-type d \( -name node_modules -o -name .next \) -prune -o \
-type f \( -name "*.js" -o -name "*.ts" -o -name "*.tsx" -o -name "*.py" -o -name "*.md" \) \
-print | xargs wc -l
# NUXT Count lines of code in a project
find . \
-type d \( -name node_modules -o -name .nuxt -o -name .output -o -name dist \) -prune -o \
-type f \( -name "*.js" -o -name "*.ts" -o -name "*.vue" -o -name "*.md" -o -name "*.css" -o -name "*.scss" -o -name "*.json" \) \
-print | xargs wc -l
# Rename all files in a directory to lowercase
for file in *; do mv "$file" "${file,,}"; done
Making Commands into macOS Shortcuts
When a command becomes part of your daily routine, it's time to make it a shortcut. Here's how:
- Open Automator (it's in your Applications folder)
- Create a new Quick Action
- Add a "Run Shell Script" action
- Paste your command
- Save it with a memorable name
My personal shortcuts:
- "Convert to WebM" - runs my ffmpeg command
- "Clean Downloads" - removes files older than 30 days
- "Docker Cleanup" - runs docker system prune
The "I'm Too Lazy to Remember" Commands
Network Diagnostics
# Check your internet speed (install speedtest-cli first)
speedtest-cli
# See what's using your network
lsof -i
# Check if a port is open
nc -zv google.com 80
System Information
# See what's eating your CPU
top
# Better version of top
htop # (install with brew install htop)
# Check disk space
df -h
# See system uptime
uptime
The "Train WiFi is Terrible" SSH Survival Guide
Ever been on a train, SSH'd into your server, started a long-running command, and then watched in horror as your connection drops right when you're going through a tunnel? Yeah, me too. Here's how to make your commands survive the journey:
The Nuclear Option: nohup + &
# Run command and detach it from your SSH session
nohup your_command > output.log 2>&1 &
# Check if it's still running
ps aux | grep your_command
# Check the output
tail -f output.log
What this does:
nohup= "no hangup" - ignores disconnection signals> output.log 2>&1= redirects all output to a file&= runs in background- Your command keeps running even if your train goes through a tunnel
The Pro Move: tmux (if available)
# Start a persistent session
tmux
# Run your command normally
your_long_running_command
# If connection drops, SSH back in and reattach
tmux attach
Why tmux is magic: You get your session back exactly as you left it. It's like having a remote desktop that survives network hiccups.
The "Oh Crap, I Already Started It" Fix: disown
# If you already started a command and forgot nohup
your_command &
disown
Pro tip: disown detaches the job from your current shell, so it won't die when you disconnect.
The "I Want to Schedule This" Approach: at
# Schedule a command to run in 1 minute
echo "your_command" | at now + 1 minute
# Check what's scheduled
atq
# Remove a scheduled job
atrm job_number
Quick Decision Matrix
| Situation | Use This | Why |
|---|---|---|
| One-off long command | nohup command & | Simple, reliable, logs output |
| Interactive work | tmux | Resume exactly where you left off |
| Already running job | disown | Emergency save for running processes |
| Scheduled execution | at | Run when you know you'll be connected |
Fun fact: The nohup command was invented in the 1970s when terminals were literally connected by phone lines that could drop. Some things never change - we're still dealing with unreliable connections, just now it's WiFi instead of copper wire.
Pro Tips & War Stories
The "I Deleted Everything" Recovery: Once I ran rm -rf * in the wrong directory. Luckily, I had a backup, but now I always double-check my current directory with pwd before running destructive commands.
The "Docker Ate My Disk" Saga: Docker images can grow like weeds. I once had 47GB of unused Docker images. Now I run docker system prune weekly like clockwork.
The "Vim Exit Struggle": Every developer has been trapped in Vim at least once. The universal solution: :q! - because sometimes you just need to get out and start over.
The "Wrong Directory" Panic: Always use pwd (Print Working Directory) before running commands that could destroy your life. Trust me on this one.
The ChatGPT Terminal Workflow
- Ask ChatGPT: "How do I convert all MP4 files in a folder to WebM?"
- Test the command on a single file first
- If it works, save it in a notes file
- If you use it 3+ times, make it a macOS shortcut
- Share it with colleagues and look like a wizard
Remember: Terminal Commands Are Like Spells
The terminal is your digital wand, and these commands are your spells. Some are simple (like ls), some are complex (like that ffmpeg command), but they all make you feel like a wizard when you use them correctly.
Pro tip: Keep a personal "spell book" of commands you use regularly. Mine is just a text file called commands.md that I update whenever I find something useful.
The best terminal users aren't the ones who memorize everything - they're the ones who know how to find the right command when they need it. Whether that's through ChatGPT, man pages, or their personal command collection, the goal is the same: get stuff done faster.
Now go forth and command-line like a wizard! 🧙♂️
Here's an extended list of lesser-known but super useful terminal commands – organized into thematic categories with explanations and fun facts, so you can level up your wizardry 🧙♂️. Many of these work on macOS/Linux out of the box, and some require one-time installs via brew or apt.
File & Folder Sorcery
| Command | What it does | Fun Fact |
|---|---|---|
stat filename | Shows detailed info about a file (permissions, size, modified time) | It's like ls -l on steroids |
tree -L 2 | Shows a tree structure up to depth 2 | Helps visualize folder hierarchies |
touch -t 202301010000 file.txt | Sets the modification time of a file manually | Useful for faking timestamps |
file filename | Tells you what type of file something is | Even works on no-extension files |
cp -r src/ dest/ | Copies folders recursively | Use with -v to watch it in action |
rsync -av --progress source/ dest/ | Fast, resumable copy of folders | Smart enough to only copy what's changed |
Search & Find
| Command | What it does | Fun Fact |
|---|---|---|
grep -rni "searchterm" . | Recursively search files (case-insensitive, show line numbers) | Grep = Global Regular Expression Print |
grep -r --include="*.js" "term" . | Limit search to specific file types | Great for codebases |
ag "searchterm" | Faster recursive search (install with brew install the_silver_searcher) | Known as "Silver Searcher" |
find . -iname "*.jpg" | Case-insensitive file search | -iname = case-insensitive -name |
locate filename | Instant search via system index (needs sudo updatedb first) | Lightning fast, like Spotlight but in terminal |
Shell Tricks & Built-ins
| Command | What it does | Fun Fact |
|---|---|---|
!! | Repeats last command | sudo !! is the classic "oops, forgot sudo" fix |
!string | Repeats last command starting with "string" | !git repeats last Git command |
^old^new | Replaces a word in your previous command and reruns | Magic for typos: ^cat^bat |
| `history | grep ssh` | Shows only your past SSH commands |
alias gs="git status" | Creates a shortcut for a long command | Store in .zshrc or .bashrc |
source ~/.zshrc | Reloads your shell config without restarting terminal | Like hot-reloading your dev environment |
Media & File Metadata
| Command | What it does | Fun Fact |
|---|---|---|
exiftool image.jpg | Displays all metadata from images (install with brew install exiftool) | You'll be surprised what your camera logs |
ffprobe -v quiet -print_format json -show_format -show_streams file.mp4 | Inspect video/audio file metadata (part of ffmpeg) | JSON output makes it scriptable |
mdls file.txt | Lists macOS metadata (Spotlight tags, etc.) | Mac-only, useful for tagging automation |
Cleanup & Organization
| Command | What it does | Fun Fact |
|---|---|---|
find . -empty -delete | Deletes all empty files and folders | Spring cleaning for your project folder |
find . -type f -name "*.log" -delete | Remove all log files | Useful after npm run dev gets chatty |
| `du -a . | sort -n -r | head -n 10` |
xargs | Chains commands with inputs from previous command | Powerful for batch operations |
rename 's/ /_/g' * | Renames files to replace spaces with underscores | Requires brew install rename on macOS |
Repetition & Automation
| Command | What it does | Fun Fact |
|---|---|---|
watch -n 1 ls -lh | Runs a command every second | Use it to live-monitor file size changes |
| `seq 1 10 | xargs -n 1 -I {} echo "Item {}"` | Creates 10 customized lines |
for i in *.mp4; do echo "Processing $i"; done | Batch loop over files | Replace echo with your logic |
| `yes | your_command` | Auto-confirms prompts |
Network
| Command | What it does | Fun Fact |
|---|---|---|
ping -c 5 google.com | Ping a server 5 times | Add -i 0.2 for faster pings |
curl -I https://example.com | Fetch HTTP headers only | Useful to check server status or redirect |
dig example.com | DNS lookup tool | dig +short gives you clean IPs |
| `netstat -an | grep LISTEN` | See open ports on your system |
ipconfig getifaddr en0 | Get your local IP (macOS) | en0 is Wi-Fi on most Macs |
whois domain.com | Check who owns a domain | Shows registrar, DNS, expiry, etc. |
System Monitoring & Debugging
| Command | What it does | Fun Fact |
|---|---|---|
lsof -i :3000 | Show what’s using port 3000 | lsof = List Open Files |
open . | Opens current folder in Finder (macOS) | Combine with cd to avoid GUI clicking |
uptime | Shows how long your system’s been running | Also shows load averages |
dscacheutil -flushcache; sudo killall -HUP mDNSResponder | Flush macOS DNS cache | Fixes weird internet issues |
vm_stat | Shows virtual memory usage | Not human-friendly, but scriptable |
| `ioreg -l | grep Capacity` | Shows real battery health (macOS) |
Advanced FFmpeg Spells
| Command | What it does | Fun Fact |
|---|---|---|
ffmpeg -ss 00:00:10 -i input.mp4 -t 5 -c copy clip.mp4 | Cuts 5s clip from 10s mark | Instant trimming without re-encoding |
ffmpeg -i input.mp4 -vf "scale=1280:-2" output.mp4 | Resize while keeping aspect ratio | -2 makes width divisible by 2 (compat!) |
ffmpeg -i input.mp4 -vf "hue=s=0" bw.mp4 | Convert to black and white | Great for minimalist video mood |
ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" fast.mp4 | 2x speed | You can also slow it down with setpts=2.0*PTS |
ffmpeg -i input.mp4 -an silent.mp4 | Strip audio | Fast for looping videos or backgrounds |
Document & Image Processing (Pandoc + ImageMagick)
| Command | What it does | Use Case |
|---|---|---|
pandoc file.md -o file.epub | Convert Markdown to EPUB | Core of the e-paper publishing workflow |
pandoc *.md -o book.epub --toc --epub-cover-image=cover.jpg | Convert multiple Markdown files into an EPUB with TOC and cover | Bundles your articles into a Kindle-ready digest |
magick input.webp output.jpg | Convert WebP to JPG | Ensures Kindle compatibility |
magick input.jpg -resize 600x output.jpg | Resize image width to 600px | Optimizes for ebook layouts |
magick montage @images.txt -tile x6 -geometry +5+5 collage.jpg | Generate collage from list of images | Used to build auto-generated covers |
identify file.jpg | Show image metadata | Used to validate and inspect downloaded images |
Bonus Tips
- Tab-complete is your friend - especially for filenames and commands (I discovered this far too late)
- Use
Ctrl + Rin terminal to reverse-search past commands - Use
Ctrl + Ato jump to start of line,Ctrl + Efor end - Create a
.dotfilesrepo to sync your aliases, functions, and~/.zshrcacross machines - Use
man commandortldr command(install viabrew install tldr) for simplified help