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.
$tail [option] [file_name]
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. |
$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