Head and tail

For testing the next few commands, we will need a fle with a sequence of numbers
1 to 100. For this, use the following command:

$ seq 100 > numbers.txt
The preceding command created a fle with the numbers 1 to 100 on separate lines.
The following example shows the usage of the
head command:
$ head // will display top 10 lines
$ head -3 numbers.txt // will show first 3 lines
$ head +5 numbers.txt // will show from line 5. Some shell may not work
this command

The following example shows the usage of the tail command:
$ tail // will display last 10 lines
$ tail -5 numbers.txt // will show last 5 lines
$ tail +15 numbers.txt // will show from line 15 onwards. Some shell may
not work

To print lines 61 to 65 from numbers.txt into fle log.txt, type the following:
$ head -65 numbers.txt | tail -5 > log.txt