1head(1) User Commands head(1)
2
3
4
6 head - display first few lines of files
7
9 /usr/bin/head
10 /usr/bin/head [-number | -n number] [filename]...
11
12
13 ksh93
14 head [-qv] [-n lines] [-c chars] [-s skip][filename]...
15
16
18 /usr/bin/head
19 The head utility copies the first number of lines of each filename to
20 the standard output. If no filename is given, head copies lines from
21 the standard input. The default value of number is 10 lines.
22
23
24 When more than one file is specified, the start of each file looks
25 like:
26
27 ==> filename <==
28
29
30
31 Thus, a common way to display a set of short files, identifying each
32 one, is:
33
34 example% head -9999 filename1 filename2 ...
35
36
37
38 ksh93
39 The head built-in in ksh93 is associated with the /bin and /usr/bin
40 paths. It is invoked when head is executed without a pathname prefix
41 and the pathname search finds a /bin/head or /usr/bin/head executable.
42
43
44 head copies one or more input files to standard output, stopping at a
45 designated point for each file or to the end of the file whichever
46 comes first. Copying ends at the point indicated by the options. By
47 default, a header of the form ==> filename <== is output before all but
48 the first file but this can be changed with the -q and -v options. If
49 no file is given, or if the file is -, head copies from standard input
50 starting at the current location.
51
52
53 The option argument for -c and -s can optionally be followed by one of
54 the following characters to specify a different unit other than a sin‐
55 gle byte:
56
57 b 512 bytes
58
59
60 k 1-kilobyte
61
62
63 m 1-megabyte
64
65
66
67 For backwards compatibility, -number is equivalent to -n number.
68
70 /usr/bin/head
71 The following options are supported by /usr/bin/head:
72
73 -n number The first number lines of each input file is copied to
74 standard output. The number option-argument must be a pos‐
75 itive decimal integer.
76
77
78 -number The number argument is a positive decimal integer with the
79 same effect as the -n number option.
80
81
82
83 If no options are specified, head acts as if -n 10 had been specified.
84
85 ksh93
86 The following options are supported by the head built-in command in
87 ksh93:
88
89 -n Copy lines from each file. The default value is 10.
90 --lines=lines
91
92 -c Copy chars bytes from each file.
93 --bytes=chars
94
95 -q Never output filename headers.
96 --quiet|silent
97
98 -s Skip skip characters or lines from each file before
99 --skip=skip copying.
100
101
102 -v Always output filename headers.
103 --verbose
104
106 The following operand is supported:
107
108 filename A path name of an input file. If no file operands are spec‐
109 ified, the standard input is used.
110
111
113 See largefile(5) for the description of the behavior of head when
114 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
115
117 Example 1 Writing the First Ten Lines of All Files
118
119
120 The following example writes the first ten lines of all files, except
121 those with a leading period, in the directory:
122
123
124 example% head *
125
126
127
129 See environ(5) for descriptions of the following environment variables
130 that affect the execution of head: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
131 and NLSPATH.
132
134 The following exit values are returned:
135
136 0 Successful completion.
137
138
139 >0 An error occurred.
140
141
143 See attributes(5) for descriptions of the following attributes:
144
145 /usr/bin/head
146 ┌─────────────────────────────┬─────────────────────────────┐
147 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
148 ├─────────────────────────────┼─────────────────────────────┤
149 │Availability │SUNWcsu │
150 ├─────────────────────────────┼─────────────────────────────┤
151 │CSI │Enabled │
152 ├─────────────────────────────┼─────────────────────────────┤
153 │Interface Stability │Committed │
154 ├─────────────────────────────┼─────────────────────────────┤
155 │Standard │See standards(5). │
156 └─────────────────────────────┴─────────────────────────────┘
157
158 ksh93
159 ┌─────────────────────────────┬─────────────────────────────┐
160 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
161 ├─────────────────────────────┼─────────────────────────────┤
162 │Availability │SUNWcsu │
163 ├─────────────────────────────┼─────────────────────────────┤
164 │Interface Stability │See below. │
165 └─────────────────────────────┴─────────────────────────────┘
166
167
168 The ksh93 built-in binding to /bin and /usr/bin is Volatile. The built-
169 in interfaces are Uncommitted.
170
172 cat(1), ksh93(1), more(1), pg(1), tail(1), attributes(5), environ(5),
173 largefile(5), standards(5)
174
175
176
177SunOS 5.11 2 Nov 2007 head(1)