head

display first part of file

Command


SYNOPSIS

head [-bcklmn num] [file ...]

head [-num] [file ...]


DESCRIPTION

By default, head displays the first 10 lines of each file given on the command line. If you do not specify file, head reads the standard input.

Options

-b num

displays the first num blocks (a block is 512 bytes) of each file.

-c num

displays the first num bytes of each file.

-k num

displays the first num kilobytes (1024 bytes) of each file.

-l num

displays the first num lines of each file.

-m num

displays the first num megabytes of each file.

-n num

displays the first num lines of each file.

-num

displays the first num lines of each file.


DIAGNOSTICS

Possible exit status values are:
0

Successful completion.

1

Failure due to any of the following:

— cannot open an input file
— read error on the standard input
— write error on the standard output
2

Failure due to any of the following:

— unknown command line option
— missing or invalid num in a -n option
Badly formed line/byte count "num"

The value num, following a -b, -c, -k, -l, -m, or -n option was not a valid number.


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0.

The POSIX.2 standard only includes the -n num and -num options though it considers the latter obsolete.


SEE ALSO

Commands:
cat, sed, tail


Updated MKS Toolkit [3khat16.ico]HP3000 [3khat16.ico]3kMail [archive16.gif]