grep是个非常高频的命令,我们通过给它设置别名,来把匹配项区分出来,这样可以更直观。

设置前:

[[email protected] ~]# /sbin/ifconfig eth0 | grep 'inet addr'
          inet addr:192.168.88.66  Bcast:192.168.88.255  Mask:255.255.255.0

设置grep高亮显示匹配项

设置别名:

cat /etc/profile

cat /etc/bashrc

[[email protected] ~]# vi ~/.bashrc

添加内容:

alias grep='grep --color=auto'

设置grep高亮显示匹配项

配置生效:

ctrl+d退出登录再进入。或运行source ~/.bashrc命令


设置完成后,再次查询IP地址,可以看到inet addr已变成红色

设置grep高亮显示匹配项


参考:

http://www.linuxidc.com/Linux/2014-09/106871.htm


转载于:https://blog.51cto.com/zhaodongwei/1760373

相关文章:

  • 2022-12-23
  • 2021-12-21
  • 2022-01-01
  • 2021-06-13
  • 2022-12-23
  • 2021-10-28
  • 2022-01-26
  • 2021-11-24
猜你喜欢
  • 2021-11-27
  • 2022-12-23
  • 2021-09-01
  • 2021-08-15
  • 2021-11-18
相关资源
相似解决方案