coreutils: head invocation
1
1 5.1 ‘head’: Output the first part of files
1 ==========================================
1
1 ‘head’ prints the first part (10 lines by default) of each FILE; it
1 reads from standard input if no files are given or when given a FILE of
1 ‘-’. Synopsis:
1
1 head [OPTION]... [FILE]...
1
1 If more than one FILE is specified, ‘head’ prints a one-line header
1 consisting of:
1
1 ==> FILE NAME <==
1
1 before the output for each FILE.
1
11 The program accepts the following options. Also see ⇒Common
options.
1
1 ‘-c [-]NUM’
1 ‘--bytes=[-]NUM’
1 Print the first NUM bytes, instead of initial lines. However, if
1 NUM is prefixed with a ‘-’, print all but the last NUM bytes of
1 each file. NUM may be, or may be an integer optionally followed
1 by, one of the following multiplicative suffixes:
1 ‘b’ => 512 ("blocks")
1 ‘KB’ => 1000 (KiloBytes)
1 ‘K’ => 1024 (KibiBytes)
1 ‘MB’ => 1000*1000 (MegaBytes)
1 ‘M’ => 1024*1024 (MebiBytes)
1 ‘GB’ => 1000*1000*1000 (GigaBytes)
1 ‘G’ => 1024*1024*1024 (GibiBytes)
1 and so on for ‘T’, ‘P’, ‘E’, ‘Z’, and ‘Y’.
1
1 ‘-n [-]NUM’
1 ‘--lines=[-]NUM’
1 Output the first NUM lines. However, if NUM is prefixed with a
1 ‘-’, print all but the last NUM lines of each file. Size
1 multiplier suffixes are the same as with the ‘-c’ option.
1
1 ‘-q’
1 ‘--quiet’
1 ‘--silent’
1 Never print file name headers.
1
1 ‘-v’
1 ‘--verbose’
1 Always print file name headers.
1
1 ‘-z’
1 ‘--zero-terminated’
1 Delimit items with a zero byte rather than a newline (ASCII LF).
1 I.e., treat input as items separated by ASCII NUL and terminate
1 output items with ASCII NUL. This option can be useful in
1 conjunction with ‘perl -0’ or ‘find -print0’ and ‘xargs -0’ which
1 do the same in order to reliably handle arbitrary file names (even
1 those containing blanks or other special characters).
1
1 For compatibility ‘head’ also supports an obsolete option syntax
1 ‘-[NUM][bkm][cqv]’, which is recognized only if it is specified first.
1 NUM is a decimal number optionally followed by a size letter (‘b’, ‘k’,
1 ‘m’) as in ‘-c’, or ‘l’ to mean count by lines, or other option letters
1 (‘cqv’). Scripts intended for standard hosts should use ‘-c NUM’ or ‘-n
1 NUM’ instead. If your script must also run on hosts that support only
1 the obsolete syntax, it is usually simpler to avoid ‘head’, e.g., by
1 using ‘sed 5q’ instead of ‘head -5’.
1
1 An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1