head Linux Commands
What is Linux head Command?
Explanation
head COMMAND:head command is used to display the first ten lines of a file, and also specifies how many lines to display.
SYNTAX :
head [options] filename
OPTIONS:
-n |
To specify how many lines you want to display. |
-n number |
The number option-argument must be a decimal integer whose sign affects the location in the file, measured in lines. |
-c number |
The number option-argument must be a decimal integer whose sign affects the location in the file, measured in bytes. |
EXAMPLE:
-
head index.php
This command prints the first 10 lines of 'index.php'.
-
head -5 index.php
The head command displays the first 5 lines of 'index.php'.
-
head -c 5 index.php
The above command displays the first 5 characters of 'index.php'.