Shell prompt builder
Build a zsh PROMPT/RPROMPT and a bash PS1 from blocks — user, host, directory, git branch and state, exit status, time, venv — with a live preview in several terminal colour schemes; paste any prompt to see it expanded and explained escape by escape; and paste zprof or a timed xtrace log to find what makes zsh slow to start.
Added
How to use it
A prompt is a small program written in two different escape languages — zsh’s %n %~ %F{…}
%(?.…) and bash’s \u \w \[\e[32m\] — and a mistake shows up as a wrong colour, a cursor in the
wrong place, or a shell that takes a second to open. This page builds prompts, reads them back to
you, and reads zsh’s start-up profiles.
How to use it
The bar at the top describes a sample machine for every preview: the terminal colour scheme, the last command’s exit status, whether you’re in a git repository (clean, changed, staged, rebasing), the directory, a Python virtualenv, background jobs, and root.
-
Build: start from a preset or add blocks — user, host, directory (full or just its name), git branch, exit status if it failed, time, jobs, virtualenv, a ❯ that turns red after a failure, text, new lines — and give each a colour (the 16 named ones, any of 256, or #rrggbb), bold, and for zsh the right-hand side. The preview shows zsh and bash side by side. Below are the lines for
~/.zshrc(withvcs_infoset up) and~/.bashrc(withgit-prompt.sh’s `__git_ps1, every escape wrapped in\[ \], and the exit status saved byPROMPT_COMMAND). -
Explain a prompt: paste a
PROMPT=…orPS1=…line from your dotfiles (quotes and all). Each escape gets a line saying what it does — conditionals, truncation, strftime formats, colours, command substitutions — and the expanded prompt is drawn underneath. It warns about colour codes outside%{ %}or\[ \], which make long command lines wrap over themselves. -
Start-up profiler: paste the table
zprofprints, or a trace log with timestamps (How to capture has the lines to put in~/.zshrc). You get the slowest functions, or the slowest lines including everything they source or call, time per file, and the usual culprits with what to do about them: nvm,compinitrun twice or without its cache, Oh My Zsh plugins,eval "$(brew shellenv)", pyenv/rbenv/conda init, generated completions such askubectl completion zsh.
Commands inside the prompt ($(…)) can’t run here: __git_ps1, git branch, tput, date,
whoami and hostname are simulated from the sample machine, and anything else is shown as a
placeholder.
Checked against
The expansion engine was compared with real zsh 5.9 (print -P, including %(…) conditionals,
%N<…< truncation and colours) and bash 5.3 (${PS1@P}) on macOS 27, escape sequences included;
those cases are in the tests. Built prompts were run in both shells in a scratch git repository
with the real vcs_info and git-prompt.sh. The profiler’s parsers were tested on output from
real zprof and xtrace runs.
For explaining whole commands, see the shell command explainer; to try things in a real shell, the Linux shell.
Feedback is a gift. Something to improve, a feature to add, or a bug? Tell me.
Runs entirely in your browser; nothing you type leaves this page.