Use
the tail command
to display the last n
lines of a file. There are several options to use with this command,
we will look at two:
+n
is used to display from line n to the end of the file (e.g.
+17 would display from line 17 to the end of the file).
-n
is used to display the last n lines of a file (e.g. -10
would display the last 10 lines of the file).
If you don't
use the -n option the last 10 lines are displayed by default.
Command
Format
tail
[-n] filename
tail
[+n] filename
n=number
of lines
For example,
to display the last 15 lines of the books.txt file the command
would be:
tail
-15 books.txt
Also,
to display from line 20 to the end of the the books.txt file the
command would be:
tail
+20 books.txt