# bashrc notes bash 登录会使用`/etc/profile`和`~/.bashrc`,视情况将如下的值保存在对应文件,使之生效。 * man 高亮 ```bash export LESS_TERMCAP_mb=$'\E[01;32m' export LESS_TERMCAP_md=$'\E[01;31m' export LESS_TERMCAP_me=$'\E[0m' export LESS_TERMCAP_se=$'\E[0m' export LESS_TERMCAP_so=$'\E[01;44;33m' export LESS_TERMCAP_ue=$'\E[0m' export LESS_TERMCAP_us=$'\E[04;32m' ``` * 支持中文 ```bash export LANG="en_US.UTF-8" export LANGUAGE="en_US:en" ``` * root 账户登录警告 ```bash echo -e "" echo -e "\e[1;31;4m -------- root warning ---------" echo -e "" echo -e " DO NOT LOGIN USE ROOT ACCOUT!!!" echo -e "" echo -e " only run 'sudo' when necessary" echo -e "" echo -e "" echo -e "\e[1;31m -------- root warning ---------" echo -e "\e[0m" PS1='\[\e[01;31m\]\u@\h ROOT WARNING!!!! \[\e[33m\]\w\[\e[32m\]\$\[\e[0m\]' ``` * PS1 ```bash PS1='\[\e[01;31m\]\u@\h\[\e[33m\]\w\[\e[32m\]\$\[\e[0m\]' #\u 用户名、\h机器名 ``` * 设置 terminal tab 标题 ```bash function set-title() { if [[ -z "$ORIG" ]]; then ORIG=$PS1 fi TITLE="\[\e]2;$*\a\]" PS1=${ORIG}${TITLE} } ```