Shell is a command language. Over time people have developed different varities of shell by adding extra features
- BASH(Born Again SHell)
- It is a command processor that generally runs in our terminal. When a user types a command an event takes place.
- Checkout this Wiki For more info
- Other types of command processors
- zsh - Another type of command processor that is extremely powerful. It was built off of BASH but has more features. You can customize it to autocomplete github repos. Unlike BASH, zsh does not follow POSIX standards.
- tcsh
You can also run bash commands from a file, this is called a script. Your bash profile runs scripts everytime you open it. If you have a styled bash prompt it is stored in your profile as a script.
- Open .bash_profile in your favorite text editor
- What do you see?
- Here are some generators you can use to style your prompt
- Find the generated output and add it to your bash profile.
- It should look something like this.
export PS1="\[\033[38;5;10m\]\H\[$(tput sgr0)\]\[\033[38;5;14m\]-\[$(tput sgr0)\]"
- It should look something like this.
- Restart your terminal and see your fancy new prompt.
- Add this code somewhere in your .bash_profile
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
- Call the function parse_git_branch in your prompt.
- It should look like this:
export PS1="\[\033[38;5;10m\]\H\[$(tput sgr0)\]\[\033[38;5;14m\]-\[$(tput sgr0)\]$(parse_git_branch)\[38;5;14m\]"
-
Return to your terminal and run
source ~/.bash_profile
-
If that didnt work try following this guide.