Copy the last part of files (POSIX)
tail [-number] [-fl] [-c number | -n number] [file]...
QNX Neutrino, Microsoft Windows
The tail utility copies its input files to the standard output, beginning at the point in the files indicated by the -c or -n option. For both options, the number argument is a decimal integer whose sign specifies the location in the file to begin copying:
If the sign is: | Then copying starts relative to the: |
---|---|
+ | Beginning of the file |
- | End of the file |
Omitted | End of the file |
If you don't specify a -c or -n option, the default is -n 10 (i.e. the last ten lines of the file).
If you use both -c and the deprecated -l option,
the order of the options is important.
If you specify:
tail -l -c 5 my_file then tail copies 5 bytes. If you specify: tail -c 5 -l my_file it copies 5 lines. |
When tail is applied to a nonseekable file (e.g. a tty), tail must maintain an internal buffer. This buffer is large enough to hold at least 10 lines of characters.
You can use the -f option to monitor the growth of a file that is being written by a process. For example, the command:
tail -f fred
prints the last ten lines of the file fred, followed by any lines that are appended to fred between the time tail is initiated and terminated. As another example, the command:
tail -f -c 15 fred
prints the last 15 bytes of the file fred, followed by any lines that are appended to fred between the time tail is initiated and terminated.