One Little Customization to One Mans Bash Prompt...

2011-09-12

I see there have been a number Bash tips posts on Hacker News recently.

Let me share an improvement for the shell I made myself only lately.

Grand Design

First a little explanation: I have a vision of how I would like my terminal application to look like:

Grand Terminal design

This design would work very well with the overall UI configuration on my Ubuntu box (I have panel and taskbar on the left, use Tree Style Tab for Firefox, Zim desktop wiki).

Pathetic Implementation

My problem is that I don't have the necessary time and GUI development experience to implement this myself.

So a couple of weeks ago I made myself a crutch -- tweaked my Bash prompt. It now looks like this:

How my shell looks currently

Although I didn't add much (just a separator line and bold style for command text) it took me some time to play with various colours and styles to achieve this effect.

The Code

I have put the configuration file on GitHub here.

I saved the file in my HOME directory and link it from my .bashrc like this:

if [ -n "$PS1" -a -f "$HOME/.bash_ps1" ]; then
    . "$HOME/.bash_ps1"
fi

Words of wisdom

I bet some of you will now go and play with your Bash prompt configuration. Let me offer you a comment by some unnamed Ubuntu/Debian maintainer wizards I found while playing with my .bashrc:

# uncomment for a colored prompt, if the terminal has the capability;
# turned off by default to not distract the user: the focus in a terminal window should be on the output of commands, not on the prompt
# force_color_prompt=yes

Comments

Bert Vermeulen

That collapsible output is just an awesome idea. You could have a keyboard shortcut to toggle collapse/expand all but the last command... I'd use that ALL the time.

Mithrandir

Your design looks awesome. After seeing it three hours ago I've started thinking on how to implement it.

Emilis Dambauskas

I hoped someone will say that ;-) Please send a link when you have some code!

Mithrandir

It will take some time as I have several other ideas too and I'm planning to take a Masters Degree while also working and taking part in the Standford's AI class. will see what I can do :)

Jason

Your design is brilliant. I particularly like the collapsible output idea. Great job.

Gary

Very glad I found this. Thanks so much for sharing it, Emilis.

@jason_lindberg

Brilliant sir! You have no idea how much I dream of a better terminal emulator and THIS is it! I would be very interested in seeing this implemented and would be willing to collaborate with anyone else who does too!

n49o7

Grouped vertical tabs. Exactly. Are you reading this, web browser?

fraterneo

Great. Works fine. Thanks!

Ammar

Awesome script. Thanks a lot.

Agvztíñ IV

Really good, thanks.

zzzzz

Take a look at byobu. It can do quite a lot.