Linux tail Command Tutorial for Beginners (5 Examples)

88565

Sometimes you want to monitor what new information is being written to a file (think of log files), or for whatever reasons, want to access the last few lines of a file. Well, there’s a command line utility that lets you do this in Linux, and it’s call tail.

In this tutorial, we will discuss the basics of the tail command using some easy to understand examples. But before we do that, it’s worth mentioning that all examples included in this article have been tested on Ubuntu 16.04 LTS.

Linux tail command

As already mentioned, the tail command outputs the last part of files supplied to it as input. Following is its syntax:

tail [OPTION]… [FILE]…

And here’s what the tool’s man page says about it:

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.

Read more at HowToForge