ITPub博客

首页 > Linux操作系统 > Linux操作系统 > grep显示加颜色

grep显示加颜色

原创 Linux操作系统 作者:lfree 时间:2010-05-19 10:17:27 0 删除 编辑


昨天看一个讲座,发现老师在执行grep命令时,匹配的字符显示有色彩的。

今天我看一下文档,发现可以通过加参数
--colour=auto 就可以了。

可以定义alias或者定义环境变量。

我喜欢定义环境变量,我定义如下:
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='01;04;32'

如果自己喜欢,可以参考如下连接来定义颜色。

http://www.termsys.demon.co.uk/vtansi.htm


Set Display Attributes

Set Attribute Mode        [{attr1};...;{attrn}m

    * Sets multiple display attribute settings. The following lists standard attributes:

      0        Reset all attributes
      1        Bright
      2        Dim
      4        Underscore       
      5        Blink
      7        Reverse
      8        Hidden

              Foreground Colours
      30        Black
      31        Red
      32        Green
      33        Yellow
      34        Blue
      35        Magenta
      36        Cyan
      37        White

              Background Colours
      40        Black
      41        Red
      42        Green
      43        Yellow
      44        Blue
      45        Magenta
      46        Cyan
      47        White


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-663079/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7969593