美文网首页
快速配置个性化CentOS7终端命令行

快速配置个性化CentOS7终端命令行

作者: 时光静好绊人心 | 来源:发表于2019-11-19 14:59 被阅读0次

配置个性化终端桌面,让终端更直观,更个性展示终端界面

配置详情:

终端名称快速修改

hostnamectl set-hostname  jia

bash

配置终端彩色字体

PS1=\[\e[30m\][\[\e[31m\]\u\[\e[33m\]@\[\e[32m\]\h \[\e[36m\]\w\[\e[34m\]]\[\e[35m\]\$ \[\e[0m\]

配置随空格在右上角显示时间或者特殊字符,Xshell中闪烁字体

编写脚本

vim jia.sh

#!/bin/bash                     

#/etc/profile

#设置随机数

num=$[RANDOM%6+1]

#定义行数及列数

lines=`tput lines`

cols=`tput cols`

col=$[${cols}-12]

#tput cup 1 $col

tput setab ${num}

tput setaf 7

tput sc ;tput blink ; tput cup 2 ${col} ; echo '<---jia--->'; tput rc

tput sgr0

tput sc ; tput cup 0 ${col} ; echo '          '; tput rc

tput sc ; tput cup 1 ${col} ; echo '          '; tput rc

将脚本拷入/usr/sbin

cp jia.sh /usr/sbin/jia.sh

编辑/etc/profile文件

添加

PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}";/usr/sbin/jia.sh'

效果显示:

相关文章

网友评论

      本文标题:快速配置个性化CentOS7终端命令行

      本文链接:https://www.haomeiwen.com/subject/zqnwictx.html