head command is used to see or go through the files from the very begining. It can show first set number of lines or characters.
Syntax:
$ head [OPTION]... [FILE]...
In its simplest form, when used without any option, the head command displays the first ten lines.
Example:
$ head filename.txt
Use the -n option followed by an integer specifying the number of lines to be shown:
Syntax:
$ head -n filename.txt
$ head -n 30 filename.txt
The same can be written as:
$ head -30 filename.txt
The -c option allows printing a specific number of bytes:
Syntax:
$ head -c filename.txt
$ head -c 100 filename.txt
If multiple files are provided as input to the head command, it will display the first ten lines from each provided file.
Example:
$ head filename1.txt filename2.txt