head

head - output the first part of files


Display the first 10 lines of a file (default):

head filename.txt

Show the first 5 lines of a file:

head -n 5 filename.txt

Show the first 30 bytes of a file:

head -c 30 filename.txt

show the filename along with the first 10 lines:

head -v filename.txt

Display the first 20 lines of a file using NUL as the delimiter:

head -z filename.txt

Display the version of head command and exit:

head --version