May 2017
Beginner
552 pages
28h 47m
English
The head command reads the beginning of the input file.
$ head file
$ cat text | head
$ head -n 4 file
This command prints the first four lines.
$ head -n -M file
For example, to print all the lines except the last five lines, use the following command line:
$ seq 11 | head -n -5
1
2
3
4
5
6
This command prints lines 1 to 5:
$ seq 100 | head -n 5