Web Development Tips

My Dream Terminal

John Cornelius | Wide Open Tech

John Cornelius, CEO & Senior Developer

Mar 17, 2020

John has over 20 years of web and software development experience, including building robust platforms for financial exchanges. He founded Wide Open Technologies over 15 years ago to bring his enterprise-level software experience to small and medium-sized businesses.

I like having pretty things, so obviously I want a pretty terminal. I most often use the terminal to navigate git repositories, so I want my terminal to tell me what repository I’m in and what branch I’m on without me having to ask it through the ‘git status’ command. I also can’t resist a good pun with a positive message, so if my terminal said “git it girl!”, it would make me super happy. 🙂 I changed the background through the terminal’s preferences, but to achieve my other dreams of the perfect terminal, I wrote a little command:

PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @ \w\[\033[0;32m\]\nbranch—> $(git branch 2>/dev/null | grep "^*" | colrm 1 2)\[\033[0;32m\]└─\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\]\[\033[0m\] \033[0m\033[1;37m\] git it girl! \[\033[0;38m\]
'

Just paste it into your terminal and hit enter. (be sure to inculde the ending parenthesis that looks like it might be a mistake, but I promise it isn’t) 🙂 Afterwards, your terminal will look like this: terminal As you can see, without running any git commands, I already know what repository I’m in, what branch I’m on, and there’s an uplifting pun to brighten my day. Hooray for my dream terminal!! And for a little extra fun, you can run this almost identical command to make the “git it girl!” blink:

PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @ \w\[\033[0;32m\]\nbranch—> $(git branch 2>/dev/null | grep "^*" | colrm 1 2)\[\033[0;32m\]└─\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\]\[\033[0m\] \033[0m\033[5;37m\] git it girl! \[\033[0;38m\]
'
Share This