head
head: output the first part of files.
Synopsis
head [-n lines] [-c bytes] [file…]
Description
head writes the first 10 lines of each file to standard output. With no file, or where a file is -, it reads standard input.
With more than one file, each one’s output is preceded by a header, ==> name <== (standard input for -), with a blank line between files.
Options
- -n lines, -nlines, -lines
- Print the first lines lines instead of 10. -n also turns off an earlier -c.
- -c bytes, -cbytes
- Print the first bytes bytes instead of lines.
Exit status
0 on success; 1 if a file could not be opened or a number was invalid.
Examples
head -n 3 /init.lua
ls -1 | head -5
Notes
Negative counts (GNU’s “all but the last n”) are not supported.
See also
tail(1), cat(1), less(1)