如何修改Ubuntu終端使用者名稱顏色修改為紅色
Linux作業系統:Ubuntu 14.04
由於輸入特定符號會導致亂碼,亂碼部分用.............顯示,有些顯示!!!!!!!!
整個作業碼流程圖片和最終顯示結果
輸入>echo $PS1
顯示:如
在個人使用者檔案夾輸入
輸入gedit ~/.bashrc
修改這幾行代碼
if [ "$color_prompt" = yes ]; then
PS1=....
else
PS1==...
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
重改為:
# if [ "$color_prompt" = yes ]; then
#PS1='$..........\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# else
# PS1='$........................\u@\h:\w\$ '
# fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
然後再檔案的末尾一行加上:
(下一行是)PS1='$...................\033[01;31m\]\u\[\033[00m\]@\h:\w\$ '
儲存後退出,然後source一下,也就是輸入>source ~/.bashrc
在root檔案夾裡面位置 /root也同樣操作一遍。
以上是我個人的修改。
以下是網上的參考:(再下面是)
customer: PS1='$........................\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
root: PS1='$........................\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '