head.1 (1725B)
- .\" utils-std: Collection of commonly available Unix tools
- .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- .\" SPDX-License-Identifier: MPL-2.0
- .Dd 2024-05-27
- .Dt HEAD 1
- .Os
- .Sh NAME
- .Nm head
- .Nd print first part of files
- .Sh SYNOPSIS
- .Nm
- .Op Fl qvz
- .Op Fl c Ar size | Fl n Ar num | Fl Ar num
- .Op Ar file...
- .Sh DESCRIPTION
- .Nm
- reads each
- .Ar file
- in sequence and writes it's first part on standard output.
- If no
- .Ar file
- is given,
- .Nm
- reads from the standard input.
- .Sh OPTIONS
- .Bl -tag -width _c_size
- .It Fl c Ar size
- Read the first
- .Ar size
- bytes
- in each
- .Ar file .
- .Pp
- .Ar size
- can be multiplied by one of KMGTP (Kilo, Mega, Giga, Tera, ...)
- using power of 1024 by default, which can be either explicit via adding iB
- (like MiB), or turned into powers of 1000 by adding B (like MB).
- .It Fl n Ar num , Fl Ar num
- Read the first
- .Ar num
- lines in each
- .Ar file .
- .Pp
- The
- .Fl Ar num
- form is historical, new scripts should use the standard
- .Fl n Ar num
- form.
- .It Fl q
- Don't print header when multiple
- .Ar file
- are given.
- .It Fl v
- Always print header, regardless of the number of given
- .Ar file .
- .It Fl z
- Use NULL as line delimiter, not newline.
- .El
- .Pp
- If no option is specified,
- .Nm
- defaults to reading the first 10 lines.
- .Sh EXIT STATUS
- .Ex -std
- .Sh STDOUT
- Contains the specified part of each
- .Ar file ,
- with the following header when multiple
- .Ar file
- are given, or when
- .Fl v
- is set:
- .Bd -literal
- "==> %s <==\\n", <file>
- .Ed
- .Sh STANDARDS
- .Nm
- should be compliant with the
- IEEE Std 1003.1-2024 (“POSIX.1”)
- specification.
- .br
- The
- .Fl q ,
- .Fl v ,
- and
- .Fl z
- options are extensions.
- The
- .Fl Ar num
- option is historical.
- .Sh AUTHORS
- .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me