版权声明:本文为博主原创文章,可以自由转载。 https://blog.csdn.net/u010953692/article/details/88845430
ubuntu 命令行提示符 颜色
1,系统版本
# cat /etc/issue
Ubuntu 18.04.2 LTS \n \l
2,修改 vim .bashrc
- 修改 #PS1='KaTeX parse error: Expected '}', got 'EOF' at end of input: …ebian_chroot:+(debian_chroot)}\u@\h:\w$ ’
# pwd
/root
# vim .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\$ '
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;33m\][\t]\[\033[00m\]\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\#\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\]\$ '
# source .bashrc
- \t 24小时格式
- # 运行的第几条命令
- $ 普通用户和超级用户
- 33m 黄色
- 32m 绿色
- 34m 蓝色
参考: