zoukankan      html  css  js  c++  java
  • Linux-常用命令记录

    (1)grep多条件搜索:

        与关系:grep -n '条件1' service.log | grep '条件2' | grep '条件3';

        或关系:grep -n service.log | grep '条件1 | 条件2';

    (2)grep按照时间搜索:

        与关系,字符条件和时间范围:grep -n 'xapi/v1/contacts' service.log | grep '2019-09-27 14:30:4[0-9]';

        精确时间范围:sed -n '/2019-10-08 09:00:00/,/2019-10-08 11:00:00/p' service.log;// 该写法就必须保证左右两个时间必须存在

    (3)grep按照行数搜索:

        查看10000行之后的所有日志:tail -n +10000 service.log;

        查询10000行前100行和后100行:cat -n service.log | tail -n +9900 | head -n 200;// 第一个条件是9900行之后的所有,第二个条件是前一个条件的前两百行

        查看多少行到多少行:sed -n '1974210,1974220p' service.log;

    (4)重置系统时间:ntpdate cn.pool.ntp.org

    (5)查找某一个目录下,带有指定搜索字符的文件名:find / -name '*search*';

        

  • 相关阅读:
    [笔记] 辛普森积分
    Luogu P4175 [CTSC2008]网络管理
    Luogu P4331 [BOI2004]Sequence 数字序列
    Luogu P1456 Monkey King
    Luogu P3261 [JLOI2015]城池攻占
    Luogu P4309 [TJOI2013]最长上升子序列
    Luogu P4246 [SHOI2008]堵塞的交通
    Luogu P3638 [APIO2013]机器人
    Luogu P4294 [WC2008]游览计划
    CF613D Kingdom and its Cities
  • 原文地址:https://www.cnblogs.com/Booker808-java/p/11605661.html
Copyright © 2011-2022 走看看