Live Preview

                
            
Prompt Elements
  • {{ elementLabel(el) }}
Element Properties
Appearance
Global Settings
Import Existing PS1
Preview Background
Generated PS1

            
        

Introduction:

In Unix-like shells, the primary prompt string, known as PS1, precedes every command you enter. It blends plain characters with escape sequences such as \u for username or \w for the working directory, which the shell evaluates on each render. A thoughtfully designed prompt improves situational awareness, quickens navigation, and reduces costly directory or host mistakes.

The in-browser generator arranges colour swatches, formatting toggles, and predefined tokens into a list that the reactive engine converts into a valid Bash escape-based PS1 string. Each element can carry foreground, background, and text attributes; optional prefix, suffix, and delimiter settings wrap and join the sequence, while a live preview instantly reflects your selections against any background.

Use it before provisioning new cloud instances to embed host-colour cues, or when sharing tutorials so readers copy an unmistakable prompt without hand-editing escape codes. Exercise caution when pasting lengthy PS1 strings into production scripts because unintended control characters can affect logging, SSH banners, or non-interactive build pipelines and automated testing environments.

Technical Details:

Bash interprets PS1 each time it draws the prompt. The string may include backslash-escaped tokens, ANSI colour codes, command substitutions, or user-defined variables. When rendering, the shell replaces each token with real-time context, wraps it in non-printing escape sequences accepted by terminal emulators, then resets attributes to avoid colour bleed. Properly balanced control characters keep cursor positioning accurate during line editing.

  1. Read prefix, delimiter, and suffix global options.
  2. For each element: substitute its token, prepend chosen styling codes, append a reset code.
  3. Concatenate elements using the delimiter.
  4. Escape literal [, ], and backslashes so Bash treats them as printable.
  5. Return the full PS1 string to the shell interpreter.
TokenExpansion
\uCurrent user name
\hHostname (short)
\wCurrent working directory
\D{<fmt>}Formatted date string
\$Prompt character (# for root, $ otherwise)

The shell prints tokens sequentially. Colour and attribute sequences wrap only the characters they precede; therefore, missing reset codes may shift the prompt or subsequent command output.

  • prefix – string placed before the first element.
  • suffix – string appended after the last element.
  • delimiter – separator between consecutive elements.
  • elements – ordered list of tokens, text fragments, or environment variables.
  • Assumes
  • terminal supports 24-bit colour escape codes.
  • Bash 4.4 + required for \D{} custom date token.
  • Prompt length should remain under typical terminal width to avoid wrapping.
  • Control sequences must start with $begin:math:display$ and end with $end:math:display$ to preserve cursor math.
  • Remote sessions with differing TERM settings may clip colour depth.
  • Older shells ignore unknown tokens, leaving raw text visible.
  • Background colour reversal may hide text on similarly coloured terminals.
  • Embedding command substitutions can degrade performance on every prompt draw.

Reference: GNU Bash Manual §6.9 “Prompting”; XTerm Control Sequences (with 24-bit colour additions).

No personal data leaves your browser; generation is executed entirely client-side and falls outside GDPR scope.

Step-by-Step Guide:

Follow this sequence to craft and install a prompt that matches your workflow.

  1. Select an element button, then tune its colours and attributes. elements
  2. Drag items in the list to reorder the prompt visually.
  3. Adjust prefix, delimiter, or suffix inside “Global Settings”.
  4. Review the live preview; toggle the advanced panel to test against different background shades.
  5. Press “Copy” and paste the generated string into ~/.bashrc; reload with source ~/.bashrc. Take care on production servers

FAQ:

What does PS1 stand for?

PS1 is Bash’s “primary prompt string”, the text displayed each time the shell expects a new command.

Is my data stored?

No. All generation happens locally; nothing is transmitted or written beyond your own clipboard.

How do I reset the prompt?

Remove or comment the PS1 line in your shell startup files and restart the terminal; Bash then falls back to its default prompt.

Why do some colours look dull?

Colour vibrancy depends on your terminal’s 24-bit colour support and theme; switch to a true-colour emulator for full fidelity.

Can I import an existing PS1?

Yes. Paste your current string into the import field; the tool parses known tokens and lets you edit them graphically.

Glossary:

PS1
Primary shell prompt string.
ANSI Code
Numeric escape sequence controlling colour or style.
Token
Placeholder replaced by the shell at runtime.
Delimiter
Character sequence joining prompt elements.
Prefix/Suffix
Strings placed before or after the assembled prompt.