Linux TAIL Command

the tail command in linux os is used to print the last N lines from the file to the terminal,by default tail command will display last 10 lines from the file.

Syntax

$tail [option] [file_name]

Opetions

Sr.No

Options

Descriptions

01

-n

it will print the last N lines of file.with leading "+" it will print the output from Nth line from the file

02

-c

it will print the last N byte of file.with leading "+",it will print the output from Nthbyte from the file.

Example


$tail file1.txt
						

display last 10 lines from file1.txt file



$tail -n3 file1.txt
						

display last 3 lines from file



$tail -3 file1.txt
						

last 3 lines from file1.txt file



$tail -n+5 file1.txt
						

starting from 5th line to end of file



$tail -c+20 file1.txt
						

skip the first 20 characters and print up to the end of file contents

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!