This post intends to give a great start to customizing your prompt, that thing you’re looking at all day whilst cruising the depths of linux ;P

If you use oh-my-zsh or any one of the other frameworks, it’s quite easy to not care and just chose one of the provided themes. Below I’ll talk about some cool projects and sources of content for managing themes in your prompt.


It’s even easier to dynamically switch themes using antigen, an open-source project which manages grabbing plugins and themes from github.

antigen theme inanimate/darkblood-modular darkblood-modular

Would automatically pull the theme I use from github and apply it. See more @ the readme.

The Gallery

Another great resource is the zsh theme gallery! It’s a pretty place I don’t get to visit too often which displays a terminal for each listed theme showing you exactly what it looks like.

example from

The Help of Others

There are tons of posts about peoples hacks on their prompts with in-depth info to help you decide or make your own.


Whatever theme you chose, try to make it as modular as possible. For example, I use the darkblood theme:

However, the original is kind of gross:

PROMPT=$'%{$fg[red]%}?[%{$fg_bold[white]%}%n%{$reset_color%}%{$fg[red]%}@%{$fg_bold[white]%}%m%{$reset_color%}%{$fg[red]%}] [%{$fg_bold[white]%}/dev/%y%{$reset_color%}%{$fg[red]%}] %{$(git_prompt_info)%}%(?,,%{$fg[red]%}[%{$fg_bold[white]%}%?%{$reset_color%}%{$fg[red]%}])
%{$fg[red]%}?[%{$fg_bold[white]%}%~%{$reset_color%}%{$fg[red]%}]>%{$reset_color%} '
PS2=$' %{$fg[red]%}|>%{$reset_color%} '

So one day in 2013, I spent a few hours and made it way better…heres a snippet:

First, some of our elements

    ## Here we define the username@host part. Some color formatting because of @ symbol.
    echo -n "%n%{$reset_color%}%{$fg[red]%}@%{$fg_bold[white]%}%m"

    ## Enter our git prompt
    if [[ "$(uname)" != "Darwin" ]]; then
        if [[ $(stat -L --file-system --format=%T .) != "nfs" ]]; then
            echo -n "%{$(git_prompt_info)%}%(?,,%{$fg[red]%}[%{$fg_bold[white]%}%?%{$reset_color%}%{$fg[red]%}])"

    ## print out the directory location
    echo -n "%~"

    ## This little guy goes just before prompt ends aka before cursor sits. Generally, this is after directory printing.
    ## I have left the reset color after this little guy since we don't want our text being colored.
    echo -n "%{$fg[red]%}> "

Then the functions that define what to include

    ## This defines the top left line of the prompt
    base username_and_host
    if [ $STY ]; then
       base in_screen

    ## This defines the second line, just below the first (left side)
    base directory_loc nospace  ## since this is the second to last printed out function (just before final declaration)

    ## Defining our right justified prompt (top)
    base fs_capacity
    base cur_fs
    base cur_date_time

Finally, put it all together


And the result

  • in a screen session called stnftw
  • last command exited with error code 1
  • env is my dotfiles git repo which has no changes


There are a lot of customizations you can do to make your prompt. Just be careful to not get too caught up in all of the awesome things you can do ;)

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.