更改shell提示行
1 通過$PS1更改
$PS1表示bsah提示符,通常情況下都是PS1='${debianchroot:+($debianchroot)}\u@\h:\w\$ '。
其中\u表示目前的用戶名,\h表示當前主機名,\w表示當前目錄,\$表示如果非root則顯示$,root顯示#。
在終端輸入export $PS1='…'就可實現更改shell提示符。但是這種更改在下次重新啓動的時候就會恢復。
2 通過~/.bashrc更改
在~/.bashrc中有這麼一段,將其中的東西更改爲你需要的即可,可長久保存。
if [ "$color_prompt" = yes ]; then # 將原提示符更改目前的提示符,如果不合適可將註釋行去掉。 # PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else # # PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' PS1='${debian_chroot:+($debian_chroot)}\w\$ ' fi