linux query log command tail grep

Use of man command

man grep

more command

//more命令主要是用来分页

| Pipe symbol

//前面的命令的输入作为后面命令的输入

Use of tail command

tail -f 100 server.log //从后面100行开始动态输出
tail -n 100 server.log //查询最后100行的日志

Use of the head command

head -n 100 server.log //查询开头100行

The use of cat command

cat server.log //查看日志

Use of grep command

cat server.log | grep -C 10 -in 'http1' 
//查询server日志中 http1的文字的上下10行展示

Use in combination

cat ./server.log |tail -n 50000 |grep -C 10 -in "http1" | more

Guess you like

Origin blog.csdn.net/qq125281823/article/details/108249464