Bash $PS1 Generator

This tool will help you generate a custom colorful bash prompt for Unix-like operating systems, including Linux and Mac OS X. [Help]

Preview This is a "live" preview of how your custom bash prompt will look in a terminal:

[user@host ~]$ _

Set preview background color: [Dark | Light]

Components You will construct your custom bash prompt by defining it one component at a time. The components are processed in order, so for example if one component sets the color to "red", text in the following component will have red text.

You can use the following bash keywords in any "Text" component. See `man bash` for a more complete list:

	\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

Delete Type Data
delete

Add new component

Result Paste the following output into your ~/.bashrc or equivalent file:

Help This is an interactive tool to aid in setting a custom (and colorful) bash command prompt.

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.

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.

Example

Enter these values in your component list (where "{space}" is a space character).

Author

Noah Petherbridge, www.kirsle.net.