head

Show the first lines of a file

What it does

head prints the start of a file, 10 lines by default. -n sets your own number: head -n 20 app.log; the short form head -20 works the same.

It is a quick look into a big file without opening all of it: the column names of a CSV, or the first entries of a log.

Syntax

head <file>
head -n <number> <file>

Examples

Related commands

Practise · All commands