zoukankan      html  css  js  c++  java
  • linux命令用来查看日志关键字

    1、查看日志 前 n行

      cat 文件名 | head -n 数量

      demo:

        cat  test.log | head -n 200  # 查看test.log前200行

    2、查看日志 尾 n行

      cat 文件名 | tail -n 数量

      demo:

        cat  test.log | tail -n 200  # 查看test.log倒数200行

    3、根据 关键词 查看日志 并返回关键词所在行

      方法一:cat 路径/文件名 | grep 关键词

      demo:

        cat  test.log | grep "http"  # 返回test.log中包含http的所有行

      方法二:grep -i 关键词 路径/文件名  (与方法一效果相同,不同写法而已)

      demo:

        grep -i "http" ./test.log  # 返回test.log中包含http的所有行(-i忽略大小写)

  • 相关阅读:
    IDEA
    elasticsearch java api
    Java-HttpUtil
    spring集成mybatis-plus
    linux语句速查
    linux切换jdk
    《Java并发编程实战》读书笔记
    设计模式六大原则
    Linux 启动管理
    Linux 日志管理
  • 原文地址:https://www.cnblogs.com/television/p/9477478.html
Copyright © 2011-2022 走看看