如何修改终端用户名颜色修改为红色(可以自由定制)

如何修改终端用户名颜色修改为红色

tipsbychsry: >表示终端输入,修改了乱码显示的问题,添加了截图显示。

整个操作代码流程图片和最终显示结果

输入>echo $PS1

显示:如上图

在个人用户文件夹输入

输入gedit ~/.bashrc

修改这几行代码

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
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='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# else
#     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
# fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir

其实也就是终端的PS1的设置注释掉然后在末尾一行重写。在末尾一行加上:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[00m\]@\h:\w\$ '

保存后退出,然后source一下,也就是输入>source ~/.bashrc

root文件夹里面位置 /root也同样操作一遍。

根据个人喜好可以自由定制,也可以这样修改:

customer:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[00m\]@\h:\[\033[01;33m\]\w\[\033[00m\]\$ '
root: PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[00m\]@\h:\[\033[01;33m\]\w\[\033[00m\]\$ '

截图效果如下:

希望大家喜欢!!!

edit-in-2015-08-16-by-chsry

 

转载于:https://www.cnblogs.com/chsry/p/4729675.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值