對於常用終端的用戶來講,好的終端配置以及終端信息顯示都是有用的甚至是酷的;
針對bash來講,能定義的東西更多,對osx和linux以及大部分的*inx
系統來講,基本都標配bash
;php
a-z
mac osx: homebrewhtml
if not install brew, install as follow:ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
then change this if you want to use tools from brew: edit /etc/paths
; change /usr/local/bin
to firstlinux
/etc/pathsgit
/usr/local/bin /usr/bin /bin /usr/sbin /sbin
$ brew install bash bash-completion
~/.bash_profile
[[ -e /usr/local/etc/bash_completion ]] && . /usr/local/etc/bash_completion
Mac默認的終端:github
PS1='\h:\W \u\$ '
=====>/etc/bashrc
ruby
huaixiaozs-Mac-BookPro:~ huaixiaoz$ -
bash
archlinux終端:app
PS1='[\u@\h \W]\$ '
=====>/etc/bashrc
curl
[huaixiaoz@archlinux ~]$ _
this
PS1='\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] '
PS1='\[\e[1;31m\][\u@\h \W]\$\[\e[0m\] '
PS1="\[\033[0;37m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[0;31m\]\h'; else echo '\[\033[0;33m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; fi)\[\033[0;37m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]"
PS1="\n\[\033[1;37m\]\342\224\214($(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h'; else echo '\[\033[01;34m\]\u@\h'; fi)\[\033[1;37m\])\342\224\200(\$(if [[ \$? == 0 ]]; then echo \"\[\033[01;32m\]\342\234\223\"; else echo \"\[\033[01;31m\]\342\234\227\"; fi)\[\033[1;37m\])\342\224\200(\[\033[1;34m\]\@ \d\[\033[1;37m\])\[\033[1;37m\]\n\342\224\224\342\224\200(\[\033[1;32m\]\w\[\033[1;37m\])\342\224\200(\[\033[1;32m\]\$(ls -1 | wc -l | sed 's: ::g') files, \$(ls -sh | head -n1 | sed 's/total //')b\[\033[1;37m\])\342\224\200> \[\033[0m\]"
上面的PS1配置來源
還有更多自定義的PS1和更多的bash特性,在此不一一列舉了,
Useful links: