Hi there, friend.
Have a seat right there and rest a spell, if you like. Can I get you something to drink?
Give me a shout on IRC or at email@example.com if you’ve got interesting stuff to say.
My public key is here, if you want to use it.
I’m also elsewhere on the Internet at bradleygannon.com.
Bash Prompt Customization and the Value of Personalization
It really wasn’t all that long ago that I’d never touched a command line before.
Circa 2013, I think I was still using Windows, and the closest I’d come to a
prompt was the occasional simple
.bat script and the Python IDLE. It was good
enough for what I was doing, I guess, and I don’t think I could have bumbled my
way into a more optimal path to my current knowledge.
When I first got into Linux, the terminal was understandably foreign. Having spent a childhood and adolescence in a GUI, it was difficult to see the value of having to type things in one at a time and—if things went perfectly—get basically no feedback. (It didn’t occur to me until writing this that the most normal output in the world from a Unix utility is nothing at all.) It became obvious even to me then that there was a lot to learn about this other world.
I’m still learning. I hope to continue as long as I can, in fact, and that’s part of why I’m writing this. In the few years since I first loaded up Ubuntu and launched the terminal, I’ve been staring at basically the same prompt. It looks a lot like this:
or if things are getting serious, like this:
This basic format has seen me through hours of debugging, configuring, laughing, crying, and ragequitting. But the problem with something so familiar is that it’s hard to remember that it can be configured, just like anything else. There was a time not long ago when I would have been afraid to irreparably damage my system by trying to make changes so fundamental to my meager operation. I still have the capacity to cause irreparable damage—it’s one of my core competencies—but I have less fear today.
The reason I got thinking about doing this is that I was watching a friend of mine use the terminal on his machine (running Fedora, I think), and the prompt he was running was amazing. I mean, this thing was like a prompt from the future. It had a cool color scheme, it showed the current time, and it was generally compact and neat. “That would be so cool to have,” I thought. “Wait, I could totally have that!”
I won’t actually go over how to do the configuration here—this is easily Google-able, which I know from related personal experience—but I will show you what I did and yammer on a bit more about the value of configuring things for comfort. Okay? Okay.
Here’s my config:
[\d \t] \u@\h \W \$
This results in something like:
[Sun Feb 23 10:12:24] bradley@enterprise blog $
Benefits of this configuration over the default:
- shows the date and time that the prompt appeared
- only shows the current directory, not the path, thus limiting the length of the prompt (I’ve had some prompts that extend over several lines due to the length of $(pwd), and it’s just madness. This is cleaner.)
- There is no third benefit.
I like this tweaked version better than the default for the reasons stated, but it’s also just nice to have personalized yet another thing about my machine. Only recently have I realized that personalizing my space (digital or physical) is actually not a waste of time, as I once thought. I take pride in minimalism and simplicity, but the more nuanced version of that opinion is that you can have those things while making things your own. I guess it’s a human thing to want the stuff around you to be yours, to be controlled. This same impulse drives me to customize my Bash prompt as much as it drives me to look for art to put on my walls or to consider whether or not my desk would be better over there rather than here. It’s mindless and silly, but it makes me feel good and hurts nobody. Really, what else is there?