修改后的效果:

操作步骤:

情况①:如果是Ubuntu或者Debian,按照下面的流程,两步解决:

  1. 打开~/.bashrc
  2. 修改参数force_color_prompt=yes去掉前面的注释#

情况②:如果是CentOS中,按照下面的流程,两步解决:

  1. 打开~/.bashrc
  2. 在文件末尾添加如下内容:
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes 

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
    # We have color support; assume it's compliant with Ecma-48
    # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
    # a case would tend to support setf rather than setaf.)
    color_prompt=yes
    else
    color_prompt=
    fi
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
unset color_prompt force_color_prompt

最新文章

  1. 豆芽儿 - 高端IT人才成长社区 上线啦!
  2. 2016 Google中国开发者大会游记
  3. win下命令行替代品Cmder
  4. User and User Groups in Linux
  5. Codeigniter CRUD生成工具
  6. Request获取URL地址相应方法
  7. 用php完成数据库的增删改查
  8. Android 三种动画详解
  9. 为什么数值类型byte取值范围是(-128~127)?
  10. ecshop微信支付(0923更新)商户支付密钥key的生成与设置
  11. SQL带参数拼接
  12. MySql命令——表相关
  13. 【玩转Ubuntu】02. Ubuntu上搭建Android开发环境
  14. 使用NSCondition实现多线程同步
  15. Android触摸屏幕时间-android学习之旅(三)
  16. SG函数和SG定理
  17. Linux学习笔记之六————Linux常用命令之系统管理
  18. 基于SaaS的企业数据隐私保护平台
  19. LeetCode104.二叉树最大深度
  20. ubuntu环境下docker的安装与操作

热门文章

  1. hdu5521 Meeting
  2. thinkphp目录解析
  3. SDUT 3402 数据结构实验之排序五:归并求逆序数
  4. C/C++中struct/union/class内存对齐
  5. [raspberry pi3] raspberry 充当time machine
  6. JavaScript CheckBox实现全选和部分选择
  7. 【C#】记录程序耗时方法
  8. 求解热传导方程matlab
  9. Orcale创建函数(function)
  10. luogu1556 幸福的路