NAME
head
—
extract file header
SYNOPSIS
head |
[-zqv ] [-n
[- ]lines|-c
[- ]bytes]
[file]… |
DESCRIPTION
Copies the first lines (default 10) or bytes of each file (standard input stream if "-", the default) to the standard output stream.
With more than one file, each one is delineated by an empty line and
==>
file<==
If lines or
bytes start with a -
, all
but the last
lines or bytes of the
files are copied.
lines and bytes are in the mostly-case-insensitive format:
[base][b|KMGTPEZY[B]]
(with at least one of {base, b,
KMGTPEZY, B})
Where base is an optionally-floating-point number of
bytes, defaulting to 1, which is then optionally multiplied
by the relevant unit. B sets the unit multiplier to
1000 (from
1024).
b(lock) is a unit of
512.
lines|bytes is equal to
, if any, or base.
OPTIONS
-n
,--lines
=- Copy the first lines of each file. Default: 10.
-c
,--bytes
=- Copy the first bytes of each file.
-n
,--lines
=-
lines- Copy all but the last lines of each file.
-c
,--bytes
=-
bytes- Copy all but the last bytes of each file.
-z
,--zero-terminated
- Line separator is NUL, not newline. File headers are still written with newlines.
-q
,--quiet
,--silent
- Never write file headers.
-v
,--verbose
- Always write file headers.
EXIT STATUS
1 if a file couldn't be opened or read.
EXAMPLES
$
find
tests/-type f -executable -exec
head
-n
2{} +
==> tests/head <== #!/bin/sh # SPDX-License-Identifier: 0BSD ==> tests/env/test <== #!/bin/sh # SPDX-License-Identifier: 0BSD ==> tests/env/code/env.1-3c <== #!/usr/bin/env -S PYTHONUNBUFFERED=1 python3 -S echo "PYTHONUNBUFFERED=$PYTHONUNBUFFERED" # Strip signature generated by Linux sign-file$
head
-c
-
754/lib/modules/$(
uname
-r
)/updates/dkms/zfs.ko
SEE ALSO
tail(1) — ‘-
’-marked
lines and bytes are symmetric,
and ‘+
’-marked ones are almost
symmetric:
{
head
-c
-
10 f;tail
-c
-
10 f;}
{
head
-n
+
10 f;tail
-n
+
11 f;}
cat
f.
STANDARDS
Conforms to