Easy Tutorial
❮ Linux Comm Gitview Linux Comm Uuname ❯

Linux head Command

Linux Command Manual

The head command is used to view the beginning part of a file. It has a common parameter -n for specifying the number of lines to display, with a default of 10, meaning it shows the first 10 lines of content.

Command Format:

head [options] [file]

Options:

Examples

To display the first 10 lines of the tutorialpro_notes.log file, enter the following command (default with parameter -n 10):

head tutorialpro_notes.log

The above command is equivalent to:

head -n 10 tutorialpro_notes.log

To display the first 5 lines of the tutorialpro_notes.log file, enter the following command:

head -n 5 tutorialpro_notes.log

To display the first 20 bytes of the file:

head -c 20 tutorialpro_notes.log

Linux Command Manual

❮ Linux Comm Gitview Linux Comm Uuname ❯