常用Shell命令1,shell命令


  • awk过滤

grep bid=12007 /usr/local/openresty/nginx/logs/error.log | awk -F '\\[ValidateTest\\] |, client' '{print $2}' > ~/Downloads/battle_12007_server.log

  • nginx的启动和关闭:
/usr/local/openresty/nginx/sbin/nginx
/usr/local/openresty/nginx/sbin/nginx -s stop
  • 时间过滤:
grep 'ValidateTest' ../logs/error.log | awk '$1$2 >="2015/12/2615:00:00" && $1$2 <= "2015/12/2616:00:00"' | more
  • 字符替换:
$ sed -i -e ‘s/foo/bar/g’ myfile.txt
-e: 表达式 -i:表示直接替换源文件
  • 字符裁剪
grep 'ValidateDG' test.log |cut -c26- > ~/Downloads/battle_client_40916_2.log
cut -c26-: 去掉前面26个字符
  • 统计当前目录空间使用情况
sudo du -sh ./* 场合:ssd快要爆了,要清理一下
  • adb查看进程
adb shell ps
  • 查看某个进程的内存
adb shell
dumpsys meminfo com.nxtomo.gch_hk_tw
  • 查找并显示前10,后10
grep -A10 -B10 ‘show item’ file

相关内容

    暂无相关文章