How to install powerline for Bash on Fedora with git branch support

August 10, 2017 - IT

I assume that you know what powerline is, if not, you can read about it here. In this post, I will show how to use it to get a better bash prompt.

Let's install it.

sudo dnf install powerline

Now you have to configure bash to use powerline by default. Edit ~/.bashrc file and add at the end:

if [ -f `which powerline-daemon` ]; then
  powerline-daemon -q
  . /usr/share/powerline/bash/

The newly opened terminal will use powerline.

Fedora - bash, powerline
Fedora - bash, powerline

Now, let's add information about current git branch.

Create powerline configuration file.

mkdir -p ~/.config/powerline

Set theme.

cat <<-'EOF' > ~/.config/powerline/config.json
    "ext": {
        "shell": {
            "theme": "default_leftonly"

Load new configuration

powerline-daemon --replace

Bash prompt should display currently used git branch.

Fedora - bash, powerline, git branch
Fedora - bash, powerline, git branch