美文网首页Kali Linux
grep过滤注释,查看有用信息,非常好用

grep过滤注释,查看有用信息,非常好用

作者: 百里江山 | 来源:发表于2020-01-08 10:42 被阅读0次

    grep -v 命令

    1. -v 或 --revert-match : 显示不包含匹配文本的所有行。

    实际应用.

    • 如下面文档(摘自redis.conf)
    # for connections from all the network interfaces available on the server.
    # It is possible to listen to just one or multiple selected interfaces using
    # the "bind" configuration directive, followed by one or more IP addresses.
    #
    # Examples:
    #
    # bind 192.168.1.100 10.0.0.1
    # bind 127.0.0.1 ::1
    #
    # ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
    # internet, binding to all the interfaces is dangerous and will expose the
    # instance to everybody on the internet. So by default we uncomment the
    # following bind directive, that will force Redis to listen only into
    # the IPv4 loopback interface address (this means Redis will be able to
    # accept connections only from clients running into the same computer it
    # is running).
    #
    # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
    # JUST COMMENT THE FOLLOWING LINE.
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    bind 127.0.0.1
    
    # Protected mode is a layer of security protection, in order to avoid that
    # Redis instances left open on the internet are accessed and exploited.
    #
    # When protected mode is on and if:
    #
    # 1) The server is not binding explicitly to a set of addresses using the
    #    "bind" directive.
    # 2) No password is configured.
    #
    # The server only accepts connections from clients connecting from the
    # IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain
    # sockets.
    #
    # By default protected mode is enabled. You should disable it only if
    # you are sure you want clients from other hosts to connect to Redis
    # even if no authentication is configured, nor a specific set of interfaces
    # are explicitly listed using the "bind" directive.
    protected-mode yes
    
    • 以上文档里好多注释, 我们想快速查看有用的配置.就可能使用如下命令.
      cat redis.conf |grep -v "#" | grep -v "^$"
    • grep -v "^$" 是去掉空行

    过滤后的结果

    bind 127.0.0.1
    protected-mode yes
    
    朕说完了.jpeg

    相关文章

      网友评论

        本文标题:grep过滤注释,查看有用信息,非常好用

        本文链接:https://www.haomeiwen.com/subject/rfwjactx.html