Linux very useful three log printing (must grasp)

1, tail -f log files - Dynamic Printing recent log file. tail -300f log file, i.e. the dynamic printing the last n lines (this example is line 300) the log file.
Here Insert Picture Description
2, grep -C 100 key filename- keyword search print out a log file in the log before and after the n-th row.
Here Insert Picture Description
3, tail -300f log file | grep 'Keywords' has been dynamic print a log file keyword. When there is a problem online, you know what logs are critical errors, and can trigger this error log to know the way, very good use.
Here Insert Picture Description

Published 10 original articles · won praise 0 · Views 359

Guess you like

Origin blog.csdn.net/weixin_43137113/article/details/104625395