zoukankan      html  css  js  c++  java
  • Linux查看配置文件中未被注释的有效配置行

    grep 命令示例——去掉注释

    $ grep -v "^#" /path/to/config/file
    $ grep -v "^#" /etc/apache2/apache2.conf

    示例输出:

    ServerRoot "/etc/apache2"
    LockFile /var/lock/apache2/accept.lock
    PidFile ${APACHE_PID_FILE}
    Timeout 300
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 15
    <IfModule mpm_prefork_module>
        StartServers          5
        MinSpareServers       5
        MaxSpareServers      10
        MaxClients          150
        MaxRequestsPerChild   0
    </IfModule>
    <IfModule mpm_worker_module>
        StartServers          2
        MinSpareThreads      25
        MaxSpareThreads      75
        ThreadLimit          64
        ThreadsPerChild      25
        MaxClients          150
        MaxRequestsPerChild   0
    </IfModule>
    <IfModule mpm_event_module>
        StartServers          2
        MaxClients          150
        MinSpareThreads      25
        MaxSpareThreads      75
        ThreadLimit          64
        ThreadsPerChild      25
        MaxRequestsPerChild   0
    </IfModule>
    User ${APACHE_RUN_USER}
    Group ${APACHE_RUN_GROUP}
    AccessFileName .htaccess
    <Files ~ "^.ht">
        Order allow,deny
        Deny from all
        Satisfy all
    </Files>
    DefaultType text/plain
    HostnameLookups Off
    ErrorLog /var/log/apache2/error.log
    LogLevel warn
    Include /etc/apache2/mods-enabled/*.load
    Include /etc/apache2/mods-enabled/*.conf
    Include /etc/apache2/httpd.conf
    Include /etc/apache2/ports.conf
    LogFormat "%v:%p %h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" vhost_combined
    LogFormat "%h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" combined
    LogFormat "%h %l %u %t "%r" %>s %O" common
    LogFormat "%{Referer}i -> %U" referer
    LogFormat "%{User-agent}i" agent
    CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined
    Include /etc/apache2/conf.d/
    Include /etc/apache2/sites-enabled/

    想要跳过其中的空行,可以使用 egrep 命令

    egrep -v "^#|^$" /etc/apache2/apache2.conf
  • 相关阅读:
    【转】属性与字段的区别
    学习C/C++的经验谈(转)
    [C++语法] 关键字typedef用法(转)
    让我们习惯在底层用C++宏生成代码 (转)
    C/C++笔试题 (二)【转】
    C/C++笔试题 (三)【转】
    C语言 printf格式控制符 完全解析
    C/C++笔试题 (一)【转】
    C++内存管理详解(转)
    【转】 Source Insight设置
  • 原文地址:https://www.cnblogs.com/gange111/p/9582637.html
Copyright © 2011-2022 走看看