For Beginners

Three useful keys of tail util

bash

tail – output the last part of files. Print the last 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name.

With no FILE, or when FILE is -, read standard input.

Tail’s keys

Show last ‘num’ lines in file:

tail -n {{num}} {{file}}

or

tail -{{num}} {{file}}

For example

$ tail -2 /etc/hosts
255.255.255.255 broadcasthost
::1             localhost

Show new lines in file interactively:

tail -f {{file}}

Show new lines in file interactively even after deletion:

tail -F {{file}}