A git aware bash prompt I use. If inside a git repo, it will display git branch and git username. It is very helpful if you have multiple github accounts.
- Download the
bash-prompt-v1.0.1.tar.gzfile from Releases page - Inspect the content, install script etc. before installing
- List the content
➤ tar -tvf bash-prompt-v1.0.1.tar.gz
drwxr-xr-x 0 muquit wheel 0 Feb 19 15:23 bash-prompt-v1.0.1/
-rw-r--r-- 0 muquit wheel 2013 Feb 19 15:23 bash-prompt-v1.0.1/bash_prompt.sh
-rwxr-xr-x 0 muquit wheel 676 Feb 19 15:23 bash-prompt-v1.0.1/install.sh
-rw-r--r-- 0 muquit wheel 804 Feb 19 15:23 bash-prompt-v1.0.1/README.md
-rw-r--r-- 0 muquit wheel 7 Feb 19 15:23 bash-prompt-v1.0.1/VERSION- To install, extract the archive and run the install script. Have a look at
the
install.shbefore running it.
➤ tar -xvf bash-prompt-v1.0.1.tar.gz
➤ cd bash-prompt-v1.0.1
➤ ./install.shIf ~/.bash_prompt.sh already exists, you will be asked whether to overwrite it.
The install script will append the following to the ~/.bashrc file if it does not
exist. Do not forget to source ~/.bashrc or log out and log back in to see
the prompt.
# bash-prompt
[[ -f ~/.bash_prompt.sh ]] && source ~/.bash_prompt.shOr clone the repo and install. Example:
git clone https://github.com/muquit/bash-prompt.git
cd bash-prompt
./install.shThen source ~/.bashrc or ~/.bash_prompt.sh
source ~/.bashrc
or
source ~/.bash_prompt.shLook at Customization section on how to use custom Unicode symbols or not
Here is a sample prompt.
- The first prompt is not in a git repo; hence there is no git branch or username
- The second prompt is showing main is the branch and muquit is the username
The decoration symbol appears to the left of the ➤ arrow in the prompt. The default is ★ .
To use a different character, create ~/.bash_prompt_decor.txt with your preferred Unicode symbol:
➤ echo "λ" > ~/.bash_prompt_decor.txtI use Unicode symbols in the prompt to easily identify which system I am on. Of course your terminal must support Unicode.
Set it to an empty string to disable it:
➤ echo "" > ~/.bash_prompt_decor.txtw3schools utf-8 charsets page has a list of various unicode symbols.
This is not my original work. Most of the prompt script was collected from
the Internet many years ago, with small updates here and there. The one
addition of my own is the parse_git_user() function, written while working
on multiple-github-accounts.
- multiple-github-accounts - How to use multiple github accounts from a single machine
TOC is created by https://github.com/muquit/markdown-toc-go on Feb-23-2026
