ubuntu下终端提示符颜色配置以及git分支配置

向~/.bashrc复制下面内容,然后重新打开终端就可以了。

颜色配置:  
PS1=’${debian_chroot:+($debian_chroot)}/[/033[01;32m/]/u@/h/[/033[00m/]: /[/033[01;34m/]/w/[/033[00m/]/$ ‘


颜色配置加git  分支:  

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

export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]: \w \[\033[31m\]\$(parse_git_branch)\[\033[00m\]$\[\033[00m\] "

猜你喜欢

转载自zhangcaiyanbeyond.iteye.com/blog/1162685