Shell Commands Nobody Bothered to Teach You
Full disclosure: I myself had genuinely never heard of two of these before writing this!
When I landed my first developer job, there was one person I loved watching: our sysadmin. I was still a beginner on Linux, and watching him work the command line was a bit like watching someone play the guitar. (As it happens, he was actually an excellent classical guitarist, too!) His fingers just knew where to go, pulling in commands and flags I hadn’t even realized existed.
One of them was tee. I’d see it in scripts and pipelines, wonder what it did, and then always forget to look it up. Years later, I finally got around to understanding it — and using it. That got me thinking: how many other useful little tools are sitting right there, waiting for us to discover them?
This is the first part of a short series about exactly those commands. Not the usual suspects like grep, sed and awk, but the less celebrated utilities that quietly solve problems you might otherwise work around by hand.
One housekeeping note before we start: not everything here is POSIX, and not everything ships by default on every machine. If you’re on macOS with zsh, a couple of these need a quick
brew install— I’ll flag those each time so there are no surprises when you actually want to use them.
🚿 tee — the one you’ve seen but never really understood
For me, tee was the one I kept coming across, but never really bothered to learn. It gets its name from the T-shaped pipe fitting: it takes one input stream and sends a copy to two destinations.
This solves a specific, recurring annoyance: you run a long command and only after staring at the output for ten minutes do you wish you’d saved it. But if you pipe it to a file, you see nothing on the screen. With tee, you don’t have to choose between watching and keeping:
./build.sh | tee build.log
./build.sh | tee build.log
You still see everything scroll past, and build.log has a full copy waiting for you. Add -a to append instead of overwrite, or hand it multiple filenames to write the same output to several files at once.
tee is part of POSIX, so this one works identically everywhere — bash, zsh, Linux, macOS, no installs, no surprises.
tee
The Open Group Base Specifications Issue 7, 2018 edition IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008)…
✅ yes — the most useless-looking one that… well, isn’t
On paper, yes is almost insulting: it prints the string y, forever, until something stops it (press CTRL+C if you don’t know how to make it stop). That’s it. That’s the whole command. The classic use is answering old-school interactive prompts that don’t have a -y flag of their own:
yes | ./installer.sh
yes | ./installer.sh
Fair warning: most modern tools already ship a non-interactive flag (like apt -y), so this trick is less handy than it used to be. yes also isn’t fussy about what string it repeats: yes "n" works just as well as yes, for the rarer case where the answer you want to automate is “no”.
The more interesting use is as a cheap, infinite source of text. Piped through head, it becomes an instant way to generate test data without writing a loop:
sample.txt” data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>
yes "test line" | head -n 100000 > sample.txt
yes "test line" | head -n 100000 > sample.txt
Run yes unpiped and it’ll happily spin your CPU at full tilt forever, which is also why, for decades, people have (wrongly) joked about using it as a stress test.
This one is not part of POSIX, but it’s so old that it feels like part of the standard, and ships by default on any macOS or Linux.
yes invocation (GNU Coreutils 9.12)
yes invocation (GNU Coreutils 9.12)
📊 column — the one you may have used by accident
If you’ve ever piped something into column -t because ChatGPT or Gemini told you to, and it mysteriously turned some text into a tidy table, you’ve already met this one. That’s really the whole trick: column looks at your input, treats whitespace (default) or another character as a field separator, and aligns everything into columns.
cat /etc/passwd | column -t -s ':'
# (or natively)
column -t -s ':' /etc/passwd
cat /etc/passwd | column -t -s ':'
# (or natively)
column -t -s ':' /etc/passwd
It’s a small thing, but it’s the difference between squinting at ragged output and actually being able to scan it.
Unfortunately, column isn’t POSIX, but it has solid cross-platform coverage: it’s native on macOS (it’s a BSD tool), and on Linux it ships as part of util-linux.
column(1) – Linux manual page
The argument columns, for the –table- options below, is a comma-separated list of user-supplied names defined…*
🧽 sponge — the one you did’t know you needed
This one I’d genuinely never heard of before digging into this list, and it fixes something I’ve absolutely done myself: sorting a file “in place” by redirecting the output back onto the same file.
file.txt” data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>
sort file.txt > file.txt
sort file.txt > file.txt
The only problem is … this doesn’t sort the file. It empties it! The shell truncates file.txt the moment it opens the file for writing — before sort ever gets a chance to read from it. By the time sort looks, there’s nothing left.
sponge exists specifically for this kind of situation: it soaks up all of its input into memory first, and only then opens the output file and writes. Same intent, no race:
sort file.txt | sponge file.txt
sort file.txt | sponge file.txt
This utility is smarter than its name suggests: it buffers in memory for typical input, but once that buffer grows past roughly half your available RAM, it automatically spills over to a temp file instead of ballooning further — so it won’t blow up on a file that’s bigger than expected, it just gets a bit slower about it.
sponge isn’t installed by default anywhere; grab it with brew install moreutils on macOS or apt install moreutils on Linux. (If you’d rather skip the dependency, sort -o file.txt file.txt solves this one specific case natively.)
sponge(1) – Arch manual pages
sponge – soak up standard input and write to a file sponge reads standard input and writes it out to the specified…
⏳ pv — watching data move through a pipe
Ever started a long-running command and found yourself wondering whether it’s still doing anything? You can check the process, inspect the disk activity, or just wait. Or you can put pv in the pipeline and watch the data move!
pv — or “pipe viewer” — sits inside a pipeline and shows you a live progress bar for data passing through, the same way a download manager shows you a transfer in progress. Unlike most of the tools in this article, it doesn’t change what’s flowing through the pipe at all; it just reports on it:
cat bigfile.sql | pv | mysql mydatabase
# (or natively)
pv bigfile.sql | mysql mydatabase
cat bigfile.sql | pv | mysql mydatabase
# (or natively)
pv bigfile.sql | mysql mydatabase
For anything that takes long enough to make you wonder whether it’s still running — a big file copy, an import, a backup — that may be precisely what you need: a progress bar and a transfer rate for commands that were never designed to report either.
Like sponge , pv is also not installed by default. brew install pv on macOS, apt install pv on Linux.
Pipe Viewer
Pipe Viewer is a free software tool to monitor and manage the progress of data through a pipeline between any two…
✏️ vipe — editing a pipeline mid-flight
The utility vipe, which issponge‘s sibling from the same moreutils package, does something that sounds like it shouldn’t be possible: it drops your editor into the middle of a pipeline. Data flows in, your editor opens with that data loaded, you look at it, change whatever you want, save, quit — and the edited version keeps flowing to whatever comes next.
sorted.txt” data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>
cat names.txt | vipe | sort > sorted.txt
cat names.txt | vipe | sort > sorted.txt
Run that, and $EDITOR opens with the contents of names.txt. Delete a line, fix a typo , then save and quit as you normally would. sort only ever sees what you left behind.
It’s a small trick, but it quietly replaces a whole annoying workflow: redirect output to a temp file, open the temp file, edit it, pipe the temp file into the next command, remember to delete the temp file. vipe collapses all of that into one step, at exactly the point in the pipeline where you need it.
Same install as sponge: brew install moreutils on macOS, apt install moreutils on Linux.
vipe(1) – Arch manual pages
vipe – edit pipe command1 | vipe | command2 vipe allows you to run your editor in the middle of a unix pipeline and…
Next up
There’s plenty more where these came from. Some of the most useful commands aren’t necessarily the ones that transform your data, but the ones that help you control what’s running, when it runs, and for how long.
A few names to look out for: watch, timeout, entr and script.
So stay tuned!
If you like my terminal content, check out Terminal Sessions for more!
Terminal Sessions
A publication for terminal enthusiasts. Discover productivity tips, customization ideas, hidden gems, and approachable…
Hi! 👋 I’m Tom. I’m a software engineer and a stress and burnout coach. If you want to get in touch, check out https://tomdeneire.be

