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

相关内容