Linux常用查看日志命令
-
cat
cat -n test.log 显示行 cat test.log 不显示行 cat *.log 所有文件后缀为log 常用组合: cat -n test.log | grep "debug" 关键字查
-
grep
grep "debug" test.log 关键字查询
-
tail
tail -f test.log 动态查看日志 tail -n 50 test.log 尾部50行
-
head
head -n 10 test.log 前10行 head -n -10 test.log 后10行 常用组合: cat -n test.log | grep "debug" | head -n 10 cat -n test.log |grep "debug" |more 分页
-
more
more test.log more -100 test.log more +100 test.log