Home » linux » Linux and Unix tail command tutorial with examples

Linux and Unix tail command tutorial with examples

Command tail displays the bottom/end of the file at the terminal.
When “tail” command is used without any option it will display the bottom/end ten lines of the file.
Syntax:

Example:

Suppose we have a file Employee.txt as shown below and we want to display the bottom/end of this file. By default tail command will display the bottom/end ten lines of the file.

Output

By default tail displayed bottom ten lies of file.

Options of tail command

Option (-n): potion “–n” is used to specify the number of lines to be display from bottom. Suppose we want to display the bottom 4 lines of file Employee.txt then the command is as follows:

Or

Output

Option (+ count): potion “+” is used to specify the line number from where the file to be displayed. Suppose we want to display line number 4 to onward of the file Employee.txt then the command is as follows:

Above command will display line number 4 to end of the file of file Employee.txt.

Please follow and like us:
error