在linux中,我们很多时候需要查看文件的配置内容,但是这样会总会看到很多含有注释的内容:
[root@localhost ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
那么,我们可以使用egrep命令:
[root@localhost ~]# egrep ^# /etc/selinux/config
^#:选择所有以#开始的
[root@localhost ~]# egrep ^# /etc/selinux/config
# This file controls the state of SELinux on the