Skip to main content

My Bash Prompt setup

This blog post might be outdated!
This blog post was published more than one year ago and might be outdated!
· One min read
Stephan Hochdörfer
Head of IT Business Operations

About one year ago, I migrated from Linux to Windows and WSL 2. During this migration, I took the opportunity to rework my Linux setup in general. I was never a fan of fancy Bash prompts and “just” had Git in Bash prompt installed. During my migration, I had a look at what other options are around and came across a Powerline-like prompt for Bash written in Go. It looked easy to customize and extend, I gave it a try and liked it.

The installation is simple, just download the Go binary and add some configuration to your .bashrc file:

go install github.com/justjanne/powerline-go@latest

My current configuration in the ".bash_rc" file looks like this:

function _update_ps1() {
eval "$($GOPATH/bin/powerline-go -error $? -shell bash -eval -cwd-mode dironly
-hostname-only-if-ssh -mode flat -modules venv,user,host,ssh,cwd,
perms,docker,git)"
}

if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi