如何修改Ubuntu終端使用者名稱顏色修改為紅色

來源:互聯網
上載者:User

如何修改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\]\$ '

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.