commands
head — preview initial lines
Print initial lines (10 by default), or initial bytes with -c. Multiple files normally add headers. With no file, reads stdin. Example assumes a fresh text-streams lab fixture.
Formal Syntax & Structure
linux syntaxlinux
head [OPTION]... [FILE]...Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| -n | option | Line count |
| -c | option | Byte count |
| FILE | operand | Input file |
Return Value
exit status and output
GNU head writes the selected initial lines or bytes and returns 0 on successful reading/writing; nonzero on error. A short file can produce fewer lines than requested without error.
Working Example
Example Snippetlinux
head -n 2 events.txt