语法:grep [搜索内容][待搜索文件]-i 忽略大小写
-v 排除包含某内容的行
eg: // 搜索/etc/inittab文件中的排除以'#'开头行的内容
[root@localhost ~]# more /etc/inittab# inittab is no longer used when using systemd.## ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.## Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target## systemd uses 'targets' instead of runlevels. By default, there are two main targets:## multi-user.target: analogous to runlevel 3# graphical.target: analogous to runlevel 5## To view current default target, run:# systemctl get-default## To set a default target, run:# systemctl set-default TARGET.target#
hello
[root@localhost ~]# grep -v ^# /etc/inittab
hello