Display first lines of a text file

The head command displays, by default, the first 10 lines of a text file in Linux. This command is often used to get an idea of the kind of text file you’re looking at; the first 10 lines are usually enough to determine what a file is.

Here is an example:

linux head command

As with tail, you can specify the number of lines you would like to display with the -n option:

linux head command n option

You can display more then one file:

linux head command multiple files

Subscribe to our Newsletter

Like us on Facebook

Geek University 2019