Setting up your terminal to be awesome

Some of the terminal defaults aren't all that great or helpful. There's a few things we can do to make working in the terminal a lot more bearable.

There are a lot of options when it comes to customizing your bash prompt if you want. This is an excellent site for customizing it to display exactly what you want. Below, we'll be setting it to display the path to your current folder so you never have to use pwd again!

Add Git tab-completion, current path, and visible branch name in the prompt

It can be hard to remember which branch you're working on with Git. It's extremely helpful to always see, front-and-center, which branch you're on. It's also really handy to be able to use tab completion on all your git commands. Adding this is pretty easy to do:

  • From anywhere in terminal, run:
curl -o ~/.git-completion.bash
  • Open ~/.bash_profile in an editor and add the following:
# Git tab completion
if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash

# Git branch in prompt
parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'

export PS1="\w\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
  • Run source ~/.bash_profile once again