maux
Star on GitHub Buy me a coffee

Manual / head

head(1)

HEAD(1) General Commands Manual HEAD(1)

head - print the first few lines of a file

head [ -n number | -number ] [ file ] ...

Head copies the first number lines of each file (standard input default) to the standard output. Number defaults to 10. -n number and the older -number form are equivalent.

With more than one file argument, the output of each is preceded by a header of the form

==> name <==

with one blank line before each header but the first. Exactly one operand, or none, never gets a header.

Head is a straight prefix copy: it stops the moment number lines have gone by, so a file's own missing final newline is carried through unchanged rather than supplied. A number larger than a file's line count copies the whole file; this is not an error.

/usr/man/HEAD this page

tail(1), cat(1), more(1)

Exit status is 0, or 1 when a file named on the command line could not be opened -- that file is skipped, a diagnostic naming it is written to standard error, and the remaining operands are still processed.

-number and -n number accept only decimal digits; anything else is a usage error, exit 2.

September 13, 2026 maux