In order to adapt a bit more my Debian Stable installation to my workflow, I’ve been tweaking the bash prompt. Simplicity and small line width are key here, because I often have tmux running with several panes in the same window and small panes with large one-liner prompts suck a lot! Everything feels crammed and hard to read. Just take a look at the image below to get an idea.
After running a few commands in each pane with this prompt configuration, everything gets really crowded and confuse. For sanity safeguarding reasons and workflow improvement, the only thing to do is customize the prompt.
The Debian Stable bash prompt, shown on the image above, default value is:
if [ “$color_prompt” = yes ]; then PS1=’${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1=’${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt
To make it more useful, I changed the second line to this:
PS1="[\033[00;32m]\u@\h[\033[00m]:\w[\033[00m]\n└─ [$(tput bold)]\$(__git_ps1 ‘[%s] ‘)\$: [$(tput sgr0)]"
All put together:
if [ “$color_prompt” = yes ]; then PS1="\[\033[00;32m\]\u@\h\[\033[00m\]:\w\[\033[00m\]\n└─ \[$(tput bold)\]\$(__git_ps1 ‘[%s] ‘)\$: \[$(tput sgr0)\]" else PS1=’${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt
And this is the result:
Not only I get a more readable prompt (and with “more room to breathe”, if you may), but I get the name of the current branch if I’m in a Git repository folder. This is a convenient feature to have if you work with this version control system.
There are a lot more ways one can configure the prompt. Both How-To Geek and Boolean World websites have nice introductory guides to get you started. The Arch Linux wiki entry about this is also a good read. Oh, and RTFM (Read The … Fine … Manual).