tail:查看尾部(最新)n行日志,可以实时;head跟tail相反,查看头部n行;
cat:倒序查看;tac:正序查看;都可以通过grep检索关键字;
sed:按日期截取、按行数截取,可截取多个;
more和less:日志过多时用来翻页,more只可往前,less可前后翻页;
根据时间区间查询 导出
sed -n '/2021-07-07 12:00:00/,/2021-07-07 12:30:00/p' nohup.out >/opt/share/2.txt
---------------------------------------------------
Linux查看进程命令
通过查看端口占用:lsof -i:8080;netstat -nlp (所有端口号);netstat -nlp | grep 80(特定端口号)。
通过程序名查看:ps -ef | grep nginx,不加grep,则是查看所有。
Linux下查看某一个程序运行所占用的内存:top -p 进程号;ps -aux | grep 进程名