Common commands
tail
Command format: tail [parameter] [filename]
Use cases
Run the following command to query the last 10 lines of data: tail -n 10 filename.log Run the following command to read 10 lines of the real-time monitoring log file: tail -10f filename.log Run the following command to query the last 10 lines of data: Tail -n +10 filename.log Queries the last 10 lines of a file: tail -f filename.log Specifies multiple files and prints the file names: tail -v file1.log file2.log
head
In contrast to tail, head looks at the first n rows of the log file
Use cases
Query the first 10 lines of a log file: head-n 10 filename.log Queries all logs except the last 10 lines of a log file: head-n-10 filename.log
cat
Use cases
Log query keywords: cat – n filename. The log | grep “debug” of the query results marked red