head - Copy the first part of files

Synopsis

head [-n count] [file ...]

Description

The head utility displays the first count lines of each of the specified files, or of standard input if no files are specified. If -n is not specified, then the first 10 lines of the file are displayed.

If more than one file is specified, each file is preceded by a header consisting of the string "==> XXX <==" where XXX is the name of the file.

Options

-n
Display count number of lines.

Exit status

  • 0 on success
  • >0 if an error occurs.

Examples

To display the first 20 lines in the file "myfile".
head -n 20 myfile