Open System Services Shell and Utilities Reference Manual (G06.29+, H06.08+, J06.03+)
User Commands (g - j) head(1)
NAME
head - Displays the beginning of a file
SYNOPSIS
head [-c bytes][-n lines][file ...]
FLAGS
-c bytes Specifies the number of bytes (not characters) to display. If the last
byte written is not a newline character, a newline character is
appended to the output.
-n lines Specifies the number of lines to display. The default value for lines is
10.
DESCRIPTION
The head command prints the first lines lines or bytes bytes of each of the specified files to the
standard output file.
If you do not specify file, head displays from the standard input file.
Environment Variables
This command supports the use of the LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and
NLSPATH environment variables.
EXAMPLES
To display the first 5 lines of a file named test,enter:
head -n 5 test
EXIT VALUES
The head command returns the following values:
0 (zero) The command completed sucessfully.
>0 An error occurred.
RELATED INFORMATION
Commands: cat(1), more(1), tail(1).
STANDARDS CONFORMANCE
This command conforms to the XPG4 Version 2 specification.
The following feature is an extension to the XPG4 Version 2 specification:
• The -c flag is supported.
527188-021 Hewlett-Packard Company 4−49