This article describes how to use the Linux Tail command. The use of the Linux Tail command is to output the last part of the specified file to a standard device, usually a terminal, in layman's terms, to display the last few lines of an archive file to the terminal, assuming that the file is updated and tail will refresh itself to ensure that you see the latest file content.
First, tail command syntax
tail [-f] [-c number |-N number |-M number |-B number |-k number] [file] parameter explanation:-F This parameter is used to monitor file growth. -c number reads the specified file from the number byte position-n number from the number line position of the specified file. -m number reads the specified file from the multiple-byte character position, for example, if your file assumes that you include Chinese characters, it is assumed that specifying the-c parameter may result in truncation, but using-m avoids the problem. -B number reads the specified file from the 512-byte block position represented by number. -K number reads the specified file from the 1KB block position represented by number. FILE specifies the target name of the operation. The above command, which involves number, assumes that 10 rows are displayed by default, if not specified. Number is preceded by a sign that indicates whether the offset is calculated from the top or from the tail. Tail can run files are generally below/usr/bin/.
Second, tail command use method demonstration example
1, tail-f filename Description: Monitor the tail of the filename file (the default 10 lines, equivalent to increase the parameter-n 10), refresh display on the screen. Exit, press CTRL + C.
2. Tail-n FileName Description: Displays the last 20 lines of the filename.
3. TAIL-R-N FileName Description: Reverse shows the last 10 lines of filename.
Add: Commands similar to the tail feature are: Cat starts displaying the contents of the archive from the first line. The TAC starts by displaying the contents of the archive from the last line. More paging displays the contents of the archive. Less is similar to more, but supports the front page head just shows the first few lines tail only shows the next few rows n with the line number showing the contents of the archive OD binary display of the contents of the file
How to use Linux tail commands