← All text tools

Bash Prompt Generator

Build a coloured Bash PS1 prompt with user, host, folder, git branch and time, see a live preview and copy the lines to paste into your bashrc file.

  • Free
  • No sign-up
  • Works on any device

About Bash Prompt Generator

The Bash prompt is stored in the PS1 variable and built from escapes such as u for the user, h for the host, w for the working folder and A for the time. This builder lets you tick which parts to show, pick a colour for each and choose a prompt symbol, and shows a live preview in a terminal-style box. It also writes the ANSI colour codes wrapped in the non-printing markers that keep long command lines wrapping correctly, and a small function that prints the git branch only inside a repository. Paste the result into your bashrc file.

How to use Bash Prompt Generator

  1. Tick the parts of the prompt you want and pick a colour for the user and host, the folder and the git branch.
  2. Choose the folder style, time format, prompt symbol and whether the symbol goes on its own line.
  3. Copy the lines into the end of your bashrc file and run source on it, or open a new terminal.

Why use this tool?

Also known as

Frequently asked questions

Why are the colour codes wrapped in square brackets?

The markers tell Bash that the enclosed characters take no space on screen. Without them, Bash miscounts the prompt length and long lines wrap or redraw badly when you edit them.

Will the preview look exactly like my terminal?

Not exactly. The preview uses sample values and approximate colours, while your terminal theme decides what red or green really looks like. The prompt text and the codes are what you paste.

How does the git branch appear?

A function runs git symbolic-ref each time the prompt is drawn and prints the branch name in brackets. Outside a repository it prints nothing, and in a detached HEAD state it also stays empty.

Is Bash Prompt Generator free?

Yes. Bash Prompt Generator on Toolipedia is free to use, with no sign-up and no watermark.

Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.