常用Shell命令1
2016-06-02 12:48
417 查看
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
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
相关文章推荐
- android wifi 无线调试
- 运维入门
- 动态清空 nohup 输出文件
- install scrapy with pip and easy_install
- 文本处理工具AWK详解
- Linux Shell常用技巧
- Shell 脚本编程陷阱
- shell字符串操作详解
- Shell中删除某些文件外所有文件的3个方法
- Ruby中执行Linux shell命令的六种方法详解
- VB使用shell函数打开外部exe程序的实现方法
- Shell编程的一些知识集合
- Shell中的for和while循环详细总结
- 什么是Shell?Shell脚本基础知识详细介绍
- Shell脚本中引用、调用另一个脚本文件的2种方法
- Shell脚本解压rpm软件包
- Linux Shell 数组建立及使用技巧
- Shell脚本实现复制文件到多台服务器的代码分享
- Shell脚本实现批量替换文件内容
- Shell脚本实现的一个简易Web服务器例子分享