More Useful and Interesting Bash Prompts

A while back, we listed 8 Useful and Interesting Bash Prompts. That turned out to be one of our most popular articles, and still generates user response and feedback. This time we’ve found a few more gems, as well as some handy tips and tricks for having the coolest shell prompt on the proverbial block.

Using These Prompts

Some of the following prompts are one-liners, and can be pasted directly into your terminal for (temporary) use. To make them permanent, you’ll have to paste the code into your .bashrc or .bash_profile.

The larger, more complex prompts such as Twtty should be saved to their own script file (such as, and you place a line like

in your .basrc file to “import” them.

Twtty Prompt

This is a two-line prompt that holds quite a bit of information including username, hostname, working directory, time, and command history number. Because of the technical and visual complexity, it’s best to place this prompt script in its own file, then source it from your .bashrc or .bash_profile as described above.


One important thing to note about this prompt is that the horizontal bar scales to fit the width of your terminal, and that the working directory line will truncate itself when it gets too large.

High-Performance Minimalist Prompt

All the complexities of a fancy prompt like Twtty do take up extra CPU cycles, and while it’s certainly not going to grind your system to a halt, it can add up. If you want something that packs a lot of info without slowing you down, I suggest this:


One interesting thing to note here is the use of the variable $? at the end. This signifies the exit status of the last command entered. 0 means all is well, any other number usually indicates an error.

Rob’s Prompt

This is one of the more popular prompts floating around the Internet. The code is small and simple, yet it gives many of the features found in the larger, more complex examples.



The name is entirely deserved – this prompt is quite large and extremely fancy. It’s got color, titlebar control, user-awareness, proxy detection, screen detection, job count, and more. In short, just about every feature found in the other prompts we’ve mentioned can be found here, and quite a few others. If you want it ALL in your prompt, this is it.


Bonus – Finding the Right Colors

As you may have noticed, most of these prompts use color, and the color is often represented in a coded form like ‘\033[1;30m’, which is quite difficult to read or remember. An easy way to see all your available colors, and preview what they’ll look like, is to simply paste the following snippet into your browser:

Which will output each color code with its number.



There are, of course infinite variations that could be packed into your prompt. Nearly any kind of textual data can be added in, and bash’s developers have had decades to add in functionality. Some readers have even commented about running custom Python or Ruby scripts from within the prompt. Whatever you do, make it functional, and if it’s REALLY cool, drop us a link in the comments!

Joshua Price

Josh Price is a senior MakeTechEasier writer and owner of Rain Dog Software


  1. I use this, it’s quite small:

    [33[01;3$( retVal=$? ; [[ $retVal =~ ^(0|130) ]] && echo -n 2m] || echo -n 1m]$retVal )u@h[33[00m]:[33[01;34m]w[33[00m]$

    If there was an error (except CTRL+C) the code is shown first and the username@host-part turns red (green on success), the current directory is always blue.

  2. Try this on a Debian based system:

    for c in {0..255} ; do
    echo -e “e[38;05;${c}m ${c} Bash Prompt Color Chart”
    done…to see a huge range of colors!

Comments are closed.