tail

Display the last few lines of the specified file on the screen

Supplementary instructions

tail command is used to input the tail content of the file.

grammar

tail (option) (parameter)

Options

-c, --bytes=NUM Output NUM (NUM is an integer) bytes at the end of the file.
-f, --follow[={name|descript}] Display the latest appended content of the file. "name" means monitoring file changes in the form of file names.
-F has the same function as "--follow=name --retry".
-n, --line=NUM Output the NUM (NUM digit) line content at the end of the file.
--pid=<process number> is used with the "-f" option to automatically exit the tail command when the process with the specified process number terminates.
-q, --quiet, --silent When there are multiple file parameters, do not output each file name.
--retry means that when the tail command is started, if the file is inaccessible or the file becomes inaccessible later, it will always try to open the file. This option needs to be used in conjunction with the option "--follow=name".
-s, --sleep-internal=<number of seconds> Used with the "-f" option to specify the number of seconds between monitoring file changes.
-v, --verbose When there are multiple file arguments, always output the individual file names.
--help Display help information for the command.
--version Display version information of the directive.

Parameters

File list: Specify the file list to display the tail content.

Example

tail file #(display the last 10 lines of file file)
tail -n +20 file # (display the contents of the file file, from line 20 to the end of the file)
tail -c 10 file # (display the last 10 bytes of the file file)

tail -25 mail.log # Display the last 25 lines of mail.log
tail -f mail.log # Equivalent to --follow=descriptor, tracking based on file descriptors. When the file is renamed or deleted, tracking stops.
tail -F mail.log # Equivalent to --follow=name --retry, trace based on the file name and keep retrying. That is, after the file is deleted or renamed, if the same file name is created again, tracking will continue.