Tail Command in Linux

Tail Command in Linux


In this article we will learn about Tail command in Linux which is most use in log check and read top selected line as per requirements.The tail command allows you to display last ten lines of any text file. Similar to the head command, tail command also support options ‘n‘ number of lines and ‘n‘ number of characters.


Command 1:- The basic syntax of tail command is:


# tail [options] [filenames]

For example, the following command will print the last ten lines of a file called ‘auth.log‘.





If more than one file is provided, tail will print the last ten lines of each file as shown below.



Command 2:- You can also print the last few lines using the ‘-n‘ option as shown below.





without putting "n" in command, it command will give same result as shown below.



Command 3:-You can also print the number of characters using ‘-c’ argument as shown below.

# tail -c5 access.log 

ymantec.com:443 - NONE/- text/html

Share:

0 comments

Please leave your comments...... Thanks