Last active
December 5, 2019 16:14
-
-
Save arthurattwell/8893daea830cb6dd9073223bed932a93 to your computer and use it in GitHub Desktop.
Set the Terminal prompt in Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the Terminal prompt in Ubuntu to: | |
# user directory (git-branch) $ | |
# Add the lines below to your ~/.bashrc file. | |
## Get Git branch | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
## Simplify prompt and add Git branch | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\] \w\[\033[01;34m\]\[\033[00m\]\[\033[01;36m\]$(parse_git_branch)\[\033[00m\] \$ ' | |
## Set title as directory | |
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\w\a\]$PS1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment