In Linux, you can use the tail command to view the last few lines of data. The purpose of this command is to view the tail content of the file; you only need to execute the "tail -n line value filename" command to view the last few lines of data from the file. View data for a specified number of rows.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
Linux View the last few lines of data in the file
Use the tail command
If you want to view the file The last few lines of data can be used:
tail -n 行数值 filename
Example: tail -n 20 filename
can display the last 20 lines of filename
Instructions:
tail command is used to view the tail content in the file. The tail command displays the last 10 lines of the specified file on the screen by default. If more than one file is given, a filename header is prepended to each file displayed. If no file is specified or the file name is "-", standard input is read.
Note: If there is a " " sign before the N value indicating the number of bytes or lines, it will be displayed from the Nth item at the beginning of the file instead of the last N items of the file. The N value can be followed by a suffix: b means 512, k means 1024, and m means 1 048576 (1M).
Syntax format:
tail [参数] [文件]
Parameters:
-f Loop reading
-q Do not display processing information
-v Display detailed processing information
The above is the detailed content of How to view the last few lines of data in a file in Linux. For more information, please follow other related articles on the PHP Chinese website!