查看日志 查找报错
cat /var/log/message
查看最后5000条并查找包含error的信息
tail -5000 /var/log/messages |grep error
tail -n 10 test.log 查询日志尾部最后10行的日志;
tail -n +10 test.log 查询10行之后的所有日志;
head查看日志
head -n 10 test.log 查询日志文件中的头10行日志;
head -n -10 test.log 查询日志文件除了最后10行的其他所有日志;
cat查看日志
cat -n test.log | grep 'error' 查询日志中含有某个关键字的信息,显示出行号