Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4591132
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:21:03+00:00 2026-05-21T22:21:03+00:00

I’m trying to get my iTerm prompt set up the same way as Paul

  • 0

I’m trying to get my iTerm prompt set up the same way as Paul Irish

So far I have the following in ~/.profile:

# Add git branch name to prompt
parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\(.*\)/ on \1/'
}

PS1='\n\[\033[0:35m\]\u\[\033[0;32m\]\w\[033[0m\]$(parse_git_branch)\n\$\[\033[0m\] '

I don’t know how to make just the branch appear in a different colour and not the preceding “on”

As well as this there are other features such as:

  • Displaying an “o” at the prompt when not in a git branch
  • Displaying a “±” when in a branch
  • Displaying the date at the end of the line

Any help would be appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T22:21:04+00:00Added an answer on May 21, 2026 at 10:21 pm

    I’ve just written a post about how to do all this. I’ve covered all the basics but had to guess a couple of things, e.g. how Paul uses the symbols etc. If you want to read it, check out http://digitalformula.net/articles/pimp-my-prompt-like-paul-irish.

    There’s also an article on digitalformula.net that shows a couple of other prompt examples – see http://digitalformula.net/articles/a-couple-more-bash-prompt-examples.

    EDITED:
    The code part is as follows:

    PATH=$PATH:~/Data/Scripts:~/Data/Utils/rar:~/_Applications:~/_Applications/lynx
    
    # alias to quickly show if any Handbrake processes are running
    alias hb='sudo ps -aef | grep HandBrakeCLI'
    
    # alias for quick DNS cache flushing
    alias fc='sudo dscacheutil -flushcache'
    
    # enable the git bash completion commands
    source ~/.git-completion
    
    # enable git unstaged indicators - set to a non-empty value
    GIT_PS1_SHOWDIRTYSTATE="."
    
    # enable showing of untracked files - set to a non-empty value
    GIT_PS1_SHOWUNTRACKEDFILES="."
    
    # enable stash checking - set to a non-empty value
    GIT_PS1_SHOWSTASHSTATE="."
    
    # enable showing of HEAD vs its upstream
    GIT_PS1_SHOWUPSTREAM="auto"
    
    BLACK=$(tput setaf 0)
    RED=$(tput setaf 1)
    GREEN=$(tput setaf 2)
    YELLOW=$(tput setaf 3)
    LIME_YELLOW=$(tput setaf 190)
    POWDER_BLUE=$(tput setaf 153)
    BLUE=$(tput setaf 4)
    MAGENTA=$(tput setaf 5)
    CYAN=$(tput setaf 6)
    WHITE=$(tput setaf 7)
    BRIGHT=$(tput bold)
    NORMAL=$(tput sgr0)
    BLINK=$(tput blink)
    REVERSE=$(tput smso)
    UNDERLINE=$(tput smul)
    
    # set the prompt to show current working directory and git branch name, if it exists
    
    # this prompt is a green username, black @ symbol, cyan host, magenta current working directory and white git branch (only shows if you're in a git branch)
    # unstaged and untracked symbols are shown, too (see above)
    # this prompt uses the short colour codes defined above
    # PS1='${GREEN}\u${BLACK}@${CYAN}\h:${MAGENTA}\w${WHITE}`__git_ps1 " (%s)"`\$ '
    
    # this is a cyan username, @ symbol and host, magenta current working directory and white git branch
    # it uses the shorter , but visibly more complex, codes for text colours (shorter because the colour code definitions aren't needed)
    # PS1='\[\033[0;36m\]\u@\h\[\033[01m\]:\[\033[0;35m\]\w\[\033[00m\]\[\033[1;30m\]\[\033[0;37m\]`__git_ps1 " (%s)"`\[\033[00m\]\[\033[0;37m\]\$ '
    
    # return the prompt prefix for the second line
    function set_prefix {
        BRANCH=`__git_ps1`
        if [[ -z $BRANCH ]]; then
            echo "${NORMAL}o"
        else
            echo "${UNDERLINE}+"
        fi
    }
    
    # and here's one similar to Paul Irish's famous prompt ... not sure if this is the way he does it, but it works  :)
    # \033[s = save cursor position
    # \033[u = restore cursor position
    
    PS1='${MAGENTA}\u${WHITE} in ${GREEN}\w${WHITE}${MAGENTA}`__git_ps1 " on %s"`${WHITE}\r\n`set_prefix`${NORMAL}${CYAN}\033[s\033[60C (`date "+%a, %b %d"`)\033[u${WHITE} '
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to loop through a bunch of documents I have to put
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.