Xshell设置主机名高亮
2024-08-29 17:12:34
修改后的效果:
操作步骤:
情况①:如果是Ubuntu或者Debian,按照下面的流程,两步解决:
- 打开
~/.bashrc
。 - 修改参数
force_color_prompt=yes
去掉前面的注释#
。
情况②:如果是CentOS中,按照下面的流程,两步解决:
- 打开
~/.bashrc
。 - 在文件末尾添加如下内容:
# 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
最新文章
- 豆芽儿 - 高端IT人才成长社区 上线啦!
- 2016 Google中国开发者大会游记
- win下命令行替代品Cmder
- User and User Groups in Linux
- Codeigniter CRUD生成工具
- Request获取URL地址相应方法
- 用php完成数据库的增删改查
- Android 三种动画详解
- 为什么数值类型byte取值范围是(-128~127)?
- ecshop微信支付(0923更新)商户支付密钥key的生成与设置
- SQL带参数拼接
- MySql命令——表相关
- 【玩转Ubuntu】02. Ubuntu上搭建Android开发环境
- 使用NSCondition实现多线程同步
- Android触摸屏幕时间-android学习之旅(三)
- SG函数和SG定理
- Linux学习笔记之六————Linux常用命令之系统管理
- 基于SaaS的企业数据隐私保护平台
- LeetCode104.二叉树最大深度
- ubuntu环境下docker的安装与操作