Ars Asks: Share your shell and show us your tricked-out terminals! The article discusses the enduring relevance of the command line interface, contrasting it with graphical user interfaces by arguing that text-based commands allow users to precisely instruct computers rather than relying on mouse gestures. The author, Lee Hutchinson, describes his personal journey from Windows to macOS in 2007, driven by his growing reliance on the bash shell for work, and notes that he still spends significant time daily using terminal windows across multiple operating systems. I spend more time today than ever before interacting with terminal windows, which is something I don’t think Past Me would have believed in the early ’90s. Back then, poor MS-DOS was the staid whipping boy of the industry, and at least on the consumer side, graphical environments like Windows and maybe even odder creatures like AmigaOS seemed poised to stamp the command line into oblivion, leaving text interfaces behind as we all blasted into the ooey-GUI future. As it turns out, though, the command line is still the best tool for some jobs—many jobs, in fact. I read a wise post some years ago probably on Slashdot arguing that a mouse-driven point-and-click interface essentially reduces the user to pointing at something on the screen and grunting, “DO DO THAT ” at the computer. The rise of right-click context menus adds the ability for the user to also grunt “MORE THINGS ” but doesn’t otherwise add vocabulary. The command line, by contrast, gives the user the opportunity to precisely tell the computer what they want done, using words instead of one or two gestalts that the computer must interpret based on context. It sounds kind of silly to say it, but the command line is what finally dragged me off Windows as my daily driver back in 2007. At the time, I’d been forced into regular bash usage at work as I took over the day-to-day administration of Boeing Houston’s fleet of then-brand-new EMC Celerra NSX enterprise NAS appliances, and while there were GUI management options available I am perhaps triggering trauma in a small subset of older readers by saying the words “EMC Control Center” , the environment I’d inherited was firmly held together by bash scripts. At first, I had turned up my nose at the Linux-ness of it all, but kind of like the fungus in The Last of Us, the shell’s tendrils slowly infected my brain. I began to realize that sad old cmd.exe and MS-DOS batch files really were kind of terrible, and that maybe, just maybe, the Linux-y ravings of my angry graybeard sysadmin mentor were not as crazy as they seemed. I didn’t think I’d ever arrive at his method of only running manually compiled Slackware—and, indeed, 20 years on, I’m still not even close—but the guy had a point. The more I used a Unix-y shell at work, the more I began to miss it at home. Windows Vista and its early WDDM woes had reduced my previously badass main PC with two Nvidia 7900GT cards in SLI to a stuttering BSOD-spitting mess, and the future of Microsoft OSes looked bleak—Windows 7 wouldn’t be along to change the situation for years. Exposure therapy to the bash shell brought me to the tipping point, and I jumped ship to the Macintosh side of the house. It was a move calculated to give me the best of all possible worlds—a good graphical interface with the same bash shell under the hood that I’d come to depend on at work. The before… Lee Hutchinson The before… Lee Hutchinson …and the after. Lee Hutchinson …and the after. Lee Hutchinson The before… Lee Hutchinson …and the after. Lee Hutchinson I haven’t looked back. These days, I run three different operating systems at home. MacOS is still my daily driver on the desktop; Windows lives on the gaming PC in the corner; and Linux in the form of Ubuntu server LTS is headless in the closet, where it belongs. God is in his heaven, and all is right with my computing world—and still, as with every day since sometime in early 2007, I spend at least an hour or two with a terminal window doing things the old-fashioned, text-y way. The fish shell long ago became my default on my Mac, in no small part because I like fish’s colors and find them helpful don’t judge me . When I’m logged into Linux, though, I stick with good old bash. I know zsh and other modern alternatives have their fans, but I’ve found my happy place, and I’m content to stay there. Being a child of the BBS era, when ANSI graphics were the hotness, I have spent about as much time as any other terminal-enjoying admin customizing my environment and making it into a place where I feel comfy working. … Oh God, I’m doing it. I’m doing the thing they do on recipe sites where all the reader really wants is directions for making pecan pie but instead gets a giant personal backstory. Forgive me. I’m old. Let’s get to the pie, and by pie, I mean the screenshots and code My favorite thing: The terminal timer It’s incredibly handy, at least for me, to have an easy-to-see reference of how long the last command took to run. You don’t need that kind of thing until you need it, and then you often really need it. To that end, I have some functions living in my .bashrc file that time each command and then append that time—and the last error code emitted—to the next bash prompt. In practice, it looks like this: I dig this. Coupled with printing the current time as part of the prompt, it gives you a good idea of not just how long the last few commands took to run but also when you were running them. That’s very handy for absentminded admins /me raises hand who leave terminal sessions up for days at a time with important work sitting in them. Here’s the code to make this happen, which you should feel free to adapt to your needs. As noted, I keep this in .bashrc as part of my PS1 prompt statement: color prompt=yes if "$color prompt" = yes ; then function timer now us { local seconds=${EPOCHREALTIME%. } local micros=${EPOCHREALTIME .} micros="${micros}000000" REPLY="${seconds}${micros:0:6}" } function timer stop { if ${timer command active:-0} -ne 1 || -z ${timer started at us:-} ; then timer show=0us return fi timer now us local delta us=$ REPLY - timer started at us local us=$ delta us % 1000 local ms=$ delta us / 1000 % 1000 local s=$ delta us / 1000000 % 60 local m=$ delta us / 60000000 % 60 local h=$ delta us / 3600000000 always show 3 digits of accuracy if h 0 ; then timer show=${h}h${m}m elif m 0 ; then timer show=${m}m${s}s elif s = 10 ; then timer show=${s}.$ ms / 100 s elif s 0 ; then timer show=${s}.$ printf %03d $ms s elif ms = 100 ; then timer show=${ms}ms elif ms 0 ; then timer show=${ms}.$ us / 100 ms else timer show=${us}us fi unset timer started at us timer command active=0 } Prompt and prompt colors function set prompt { local Last Command=${1:-$?} FancyX='\342\234\227' Checkmark='\342\234\223' export PS1="\n$WHITE \t " if $Last Command == 0 ; then PS1+="\$? $GREEN$Checkmark " else PS1+="\$? $RED$FancyX " fi timer stop PS1+="$WHITE $timer show " PS1+="\n\ $HOSTCOLOR\ \u@\h\ \033 00m\ :\ \033 1;38;5;027m\ \w\ \033 00m\ \\$ " } function timer prompt command { local last command=${1:-$?} set prompt "$last command" } PS0='${ timer now us; timer started at us=$REPLY; timer command active=1; }' PROMPT COMMAND='timer prompt command' fi This mess of functions will jam all that goodness into your prompt, complete with a fancy green “check” if the program exited with error code 0 or a red “X” and the error code if it exited with something else. The color definitions—$WHITE, $BLUEBOLD, $HOSTCOLOR, and others—are just plain ol’ ANSI escape sequences defined elsewhere in .bashrc and not presented here to try to keep the code excerpts from being too long. You can and should replace them with whatever tickles your fancy. The timer stop function also has the job of converting the timer into a human-readable format, and it’s probably messier than it needs to be. I’m no developer, though, so this is what Past Lee settled on after a few hours of searching through examples. Doing it in fish for folks like me That’s for bash when I’m ssh’d into one of my Linux hosts, but I run fish on MacOS. I have a separate fish function for getting the same results there, complete with gross hacks for turning the measurement into human-readable form. I made this code, and I am unapologetic. Witness my cobbled-together StackOverflow-sourced kludge. function fish prompt --description 'Write out the prompt' Save the last status set -l last status $status Calculate the command duration if available set -l cmd duration "" if set -q CMD DURATION Convert milliseconds to microseconds for more precise comparison set -l duration us math "$CMD DURATION 1000" Calculate different time units set -l us math "$duration us % 1000" set -l ms math "floor $duration us / 1000 % 1000" set -l s math "floor $duration us / 1000000 % 60" set -l m math "floor $duration us / 60000000 % 60" set -l h math "floor $duration us / 3600000000 " Format duration string if test $h -gt 0 set cmd duration string join '' " " $h "h" $m "m " else if test $m -gt 0 set cmd duration string join '' " " $m "m" $s "s " else if test $s -ge 10 set -l fraction math "floor $ms / 100 " set cmd duration string join '' " " $s "." $fraction "s " else if test $s -gt 0 set cmd duration string join '' " " $s "." printf "%03d" $ms "s " else if test $ms -ge 100 set cmd duration string join '' " " $ms "ms " else if test $ms -gt 0 set -l fraction math "floor $us / 100 " set cmd duration string join '' " " $ms "." $fraction "ms " else set cmd duration string join '' " " $us "us " end end Define unicode symbols for status set -l checkmark "✓" set -l cross "✗" Colors set -l normal set color normal set -l dark gray set color 555555 set -l blue set color -o blue set -l red set color red set -l green set color green set -l purple set color -o purple First line echo New line echo -n -s $dark gray " " date +%T " $last status " Time in brackets and exit status Status indicator with exit status if test $last status -eq 0 echo -n -s $green $checkmark else echo -n -s $red $cross end Actually echo the duration echo -n -s $dark gray " $cmd duration" Do the rest of the prompt echo set -l host color $purple echo -n -s $host color $USER "@" prompt hostname $normal ":" $blue prompt pwd $normal " \$ " end A splash of color Spending my formative years immersed in ANSI BBS graphics has probably made me a little more fond of colorful text in my terminal than the average frumpy, button-downed admin. Look, I know some folks feel that syntax highlighting and colors in general kill comprehension and encourage skimming, but what can I say? I love them and rely on them. Perhaps I skim too much, but so be it. You can take my colorful shell tools from my cold, dead hands. To that end, I lean on a little program called GRC for Generic Colorizer to add highlighting and coloration to other tools. It’s broadly available and works without any additional configuration. Nothing wrong with a little color Lee Hutchinson Nothing wrong with a little color Lee Hutchinson Nothing wrong with a little color Lee Hutchinson There’s a bit of aliasing which I keep in .bash aliases like a good citizen to make colorful output the defaults on some common commands: alias ls='ls --color=auto' alias ll='ls -AlFh --group-directories-first' alias df='grc df -h' alias du='grc du -h' alias free='grc free -h' alias ping='grc ping' alias traceroute='grc traceroute' alias ip='grc ip' I’m also a big fan of making my numbers human-readable, and the -h switch is therefore applied liberally. Do note that wrapping commands like ip in GRC can sometimes do weird things if you’re piping its output into something else. Use caution. Or don’t It’s your computer, knock yourself out The terminal itself Sharp-eyed readers will note from the screenshots that I’m using MacOS’s Terminal.app for my terminal program, despite there being far better options. I suppose the excuse I have is that I’m comfy with Terminal.app and nothing has pulled me off of it. I’ve test-driven the usual suspects—Ghostty, Alacritty, the mighty iTerm2 with its awesome tmux windowing integration, and even fancy new reinterpretations of the terminal experience like Warp. But I just can’t find a reason to switch that sticks with me. Changing terminal applications inevitably means things look different—ANSI colo