输入: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 #注释掉改为: # 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
并在文本最后添加如下一行代码
#customer: PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\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\]\$ '
保存后退出,然后source
中间的主机名也可修改,参考默认的特殊符号所代表的意义
如要设置成其他颜色可参考下列字体颜色代码
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。