powerbash

one file, sourced into your shell

Your shell already knows all this.

powerbash puts the branch you are on, whether it is dirty, how far ahead of the remote you are, and what the last command returned right where you are already looking. Pure bash — no dependencies, no patched fonts.

napalmwebapp»feature/prompt-redesign + ⇡1$git push

install

Into your own account.

powerbash needs no privileges and touches nothing outside your home directory. Use Homebrew if you have it — upgrades then come along with everything else. The other two are for machines that do not.

Homebrew recommended

macOS or Linux. Upgrades along with everything else you have installed.

brew install powerbash/powerbash/powerbash

Install script

For machines without Homebrew. Downloads the script and wires it into your shell startup file. Run it again any time to upgrade, or pass uninstall to remove it.

curl -s https://get.powerbash.org | bash

By hand

One file and one line. Use ~/.bash_profile on macOS, where terminals start login shells.

curl -Ls https://download.powerbash.org/powerbash.sh -o ~/powerbash.sh
echo 'source ~/powerbash.sh' >> ~/.bashrc

Start a new shell afterwards, or run exec bash. Installing for every account on a machine is possible but discouraged — see multi-user installs for what it costs you.

every segment is a toggle

Build a prompt.

Turn segments on and off. The prompt updates, and so does the list of commands that would get you there — the same ones you would type into a shell, all of them tab-completable.

▶ .venvnapalm@build-01/home/napalm/src/webapp/src/components/widgetswidgets/home/.../components/widgets..c/components/widgets/h/n/s/w/s/c/widgets»feature/prompt-redesign + ⇡12$127

# type these to keep what you pickedpowerbash py virtualenv offpowerbash user offpowerbash host offpowerbash path offpowerbash path fullpowerbash path partedpowerbash path shortpowerbash path minipowerbash git offpowerbash jobs offpowerbash rc offpowerbash config save

Segments

Starting from the defaults powerbash ships with.

Show
Path

what the colors mean

Reading a prompt.

Segment Looks like Tells you
virtualenv ▶ .venv A Python or Conda environment is active. short trims the name to five characters; icon drops the name entirely.
user napalm Who you are. Turns yellow under sudo and over SSH.
host @build-01 Which machine. Hidden until you are over SSH, so it takes up room only when that is a thing you might forget.
path widgets Where you are, in one of five widths. Always ~ at home.
git »main + ⇡2 ⇣1 Branch — or a tag or short SHA when the head is detached. + means uncommitted changes; and count commits ahead of and behind the remote.
jobs 2 Background jobs in this shell. Appears only when there are some.
symbol $ Where your command goes. # and red when you are root.
return code 127 What the last command exited with. Appears only when it was not zero.

why it stays out of the way

One file. Nothing else.

No dependencies

No Python, no Go, no daemon, no font patching. Bash, plus tput and git if you have them. Without those it still renders, just plainer.

bash 3.2 and up

Including the /bin/bash macOS still ships. Every change is tested against that, against current bash, and on Linux and macOS.

No fork per prompt

Segments write straight into PS1 rather than running subshells, and git state comes from one call. On slow filesystems you can time it out or skip whole paths.

Nothing gets executed

A branch or directory named $(rm -rf ~) is escaped before it reaches PS1. Saved settings are read back through an allowlist, never sourced.