linux 排查项目问题常用命令

  1.  查看日志
    1. 头部开始查询文件file.log前100中包含'测试'的记录前后一行,并形成文件为new.log
      head -n 100 file.log|grep -1 '测试' > new.log
    2. 尾部开始查询文件file.log前100中包含'测试'的记录前后一行,并形成文件为new.log
      tail -n 100 file.log|grep -1 '测试' > new.log
    3. 文件列表显示明细信息,文件大小单位为m
      ls -lh
  2. 文件操作
    1. 创建文件夹

      mkdir
      复制文件
      cp
      删除文件
      rm -rf
      解压文件
      gzip -d file.gz
      查找程序名 eg:java
      whereis java
      查找文件 查找小写字母开头的.c文件
      find . -name ‘[a-z]*.c‘ -print ~表示home目录,.表示当前目录,/表示根目录
      编辑文件
      vi

  3. 网络接口连通性
    1. 模拟访问
      curl -v opengate.nxeduyun.com
    2. 模拟post访问,get直接访问即可
      curl -H "Content-type: application/json" -X POST -d '{"appId":"AP0364391846641","userId":"29974F6145364975E053271911AC64CA"}' http://www.xxxx.com/index.php?r=api/school/hasApppow/school/hasAow
    3. 循环模拟访问
      count=0; while [ true ]; do count=`expr $count + 1`; sleep 0.1; curl -o /dev/null -s -w "$count. %{time_namelookup} - %{time_total} - %{http_code}\n" http://xxx.xxx.com; done
  4.  java 程序
    1. 查看'java'进程 ps -ef|grep 'java'
    2.  arthas 分析java进程 wget https://arthas.aliyun.com/arthas-boot.jar

 

posted @ 2022-12-07 11:33  hyiam  阅读(71)  评论(0编辑  收藏  举报