Chinaunix首页 | 论坛 | 博客
  • 博客访问: 311205
  • 博文数量: 96
  • 博客积分: 230
  • 博客等级: 二等列兵
  • 技术积分: 722
  • 用 户 组: 普通用户
  • 注册时间: 2012-02-13 22:25
个人简介

心安处即吾乡!

文章分类

全部博文(96)

文章存档

2016年(1)

2014年(79)

2013年(7)

2012年(9)

我的朋友

分类: LINUX

2014-05-22 18:27:40

1、将下面的代码拷贝到~/.bash_login中,可以让man有颜色

export LESS_TERMCAP_mb=$'\E[01;31m'

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[01;32m'

## 指定less为默认阅读器

export PAGER=less

 

2、让ls有颜色显示,可以在~/.bash_profile中加入:

alias ls=’/bin/ls --color=auto’  ## 如果ls已经是有彩色输出了, 可忽略

 

3、让grep可以高亮选择的关键字,可以在~/.bash_profile中加入:

alias grep='grep --color'    ## 这个是强烈推荐的, 用过多后肯定会喜欢

 

4、解释一下各个配置文件的读取顺序:

  • 当一个login bash 启动后, (如ssh 登录成功后, 或 bash –login 运行时), login bash将会按以下逻辑去读取配置文件

[[ -r /etc/profile ]] && source /etc/profile

if [[ -r ~/.bash_profile ]]; then

       source ~/.bash_profile

elif [[ -r ~/.bash_login ]]; then

       source ~/.bash_login

elif  [[ -r ~/.profile ]]; then

       source ~/.profile

fi

  • 当一个非login 且是interactive的 bash启动时, (如执行bash并回车)  ## 如果对login bash, interactive bash的概念不清, 可找俺详谈, 或man bash Bash将按以下逻辑去读取个人配置

[[ -r ~/.bashrc ]] && source ~/.bashrc

值得注意的是, 一个login bash并不会去执行 [[ -r ~/.bashrc ]] && source ~/.bashrc

 

以上所讲的配置都是基于 bash 而不是 sh (即使 sh  bash symbol link, 即使vivimsymbol link, 以不同的名字运行时效果并不完全一样)

阅读(2543) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~