tail - Linux command line to display the tail of a fileFollow @ggarron
This is a command related to my previous post about head - Linux command line but this one opposite to head displays the tail of the file instead of the head.
It also has a great feature, if you use it with the -f option you will have a never end file that will continue showing in the screen the new lines that got appended to the file, this is extremely useful when you are debugging, and using file like those in /var/log directory.
See how it works
Usage tail [options] [file-list]
- Tail counts bytes instead of lines to display, so it displays the last n bytes you specify here in the n option, the [u] option is optional and it is for you to indicate if you want.
- b = bytes
- k = kilobytes
- m = megabytes
- After showing the last line of the file, tail stays waiting for new lines and it will display them as soon as they are written to the file, you can specify more than one file in the [file-list] and in that case tail will tell you from which file the new line showing comes from.
- -n [+]n[u]
- This is the default option, and it works like -c but now it count lines instead of bytes, you can also specify the [u] parameter, to indicate bytes, kilobytes or megabytes, and you can also use the + sign to indicate tail to count from the top of the file rather than from the end.