![【摘】使用tail、head命令过滤行 【摘】使用tail、head命令过滤行](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700)
tail -n 10 test.log 查询日志尾部最后10行的日志;
tail -n +10 test.log 查询10行之后的所有日志;
head -n 10 test.log 查询日志文件中的头10行日志;
head -n -10 test.log 查询日志文件除了最后10行的其他所有日志;
cat -n test.log |tail -n +92|head -n 20
tail -n +92表示查询92行之后的日志
head -n 20 则表示在前面的查询结果里再查前20条记录