[user@host ~]$ _
Set preview background color: [Dark | Light]
You can use the following bash keywords in any "Text" component. See `man bash` for a more complete list:
man bash
\u The name of the logged-in user \h The hostname up to the first '.' \H The full hostname \n Newline \$ Shows a $ for a regular user or # for root user \\ A literal backslash "\" character
~/.bashrc
export PS1="[\u@\h \W]\\$ "
Unlike other prompt generating tools that insert ANSI escape sequences to set colors for your prompt, this one uses the bash \[$(...)\] sequence to use the tput command to set the colors. This means that bash has a more accurate internal idea of how long your prompt is, so that word wrapping for example behaves correctly as you enter a long command.
\[$(...)\]
tput
How to Use
You'll construct a custom bash prompt by using the Components builder above. The components are processed in order, so for example if you have a "Set color -> red" followed by text, that text will be displayed in red in your bash prompt.
A live preview (generated via JavaScript) will give you a rough idea how your prompt is going to look so far. It has built-in support for handling common bash keywords such as \u and \h, but it won't process more complicated ones. The final output for your .bashrc file will be shown in the "Result" box that you can paste into your .bashrc. Starting a new bash shell after saving the changes should show your new bash prompt.
.bashrc
Example
Enter these values in your component list (where "{space}" is a space character).
Noah Petherbridge, www.kirsle.net.