Move everything from /var/adm to /var/log
[unleashed.git] / share / man / man1 / head.1
blobf34c4c93fae07e8b6baf271b8e3c4d4b6ccb7357
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions
45 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
46 .\" Portions Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved
47 .\" Portions Copyright (c) 2013, Joyent, Inc. All Rights Reserved
48 .\"
49 .TH HEAD 1 "Mar 4, 2013"
50 .SH NAME
51 head \- display first few lines of files
52 .SH SYNOPSIS
53 .SS "/usr/bin/head"
54 .LP
55 .nf
56 \fB/usr/bin/head\fR [\fB-q\fR] [\fB-v\fR] [\fB-number\fR ] [ \fB-n\fR \fInumber\fR ] [ \fB-c\fR \fInumber\fR] [\fIfilename\fR]...
57 .fi
59 .SS "ksh93"
60 .LP
61 .nf
62 \fBhead\fR [\fB-qv\fR] [\fB-n\fR \fIlines\fR] [\fB-c\fR \fIchars\fR] [\fB-s\fR \fIskip\fR] [\fIfilename\fR]...
63 .fi
65 .SH DESCRIPTION
66 .SS "/usr/bin/head"
67 .sp
68 .LP
69 The \fBhead\fR utility copies the first \fInumber\fR of lines of each
70 \fIfilename\fR to the standard output. If no \fIfilename\fR is given,
71 \fBhead\fR copies lines from the standard input. The default value of
72 \fInumber\fR is \fB10\fR lines. If \fB-c\fR is specified, \fBhead\fR
73 copies the first \fInumber\fR of bytes of each filename.
74 .sp
75 .LP
76 When more than one file is specified, the start of each file looks like:
77 .sp
78 .in +2
79 .nf
80 \fB==>\fR \fIfilename\fR \fB<==\fR
81 .fi
82 .in -2
84 .sp
85 .LP
86 Thus, a common way to display a set of short files, identifying each one, is:
87 .sp
88 .in +2
89 .nf
90 example% \fBhead -9999 filename1 filename2 ...\fR
91 .fi
92 .in -2
93 .sp
95 .SS "ksh93"
96 .sp
97 .LP
98 The \fBhead\fR built-in in \fBksh93\fR is associated with the \fB/bin\fR and
99 \fB/usr/bin\fR paths. It is invoked when \fBhead\fR is executed without a
100 pathname prefix and the pathname search finds a \fB/bin/head\fR or
101 \fB/usr/bin/head\fR executable.
104 \fBhead\fR copies one or more input files to standard output, stopping at a
105 designated point for each file or to the end of the file whichever comes first.
106 Copying ends at the point indicated by the options. By default, a header of the
107 form \fB==> filename <==\fR is output before all but the first file but this
108 can be changed with the \fB-q\fR and \fB-v\fR options. If no file is given, or
109 if the file is \fB-\fR, \fBhead\fR copies from standard input starting at the
110 current location.
113 The option argument for \fB-c\fR and \fB-s\fR can optionally be followed by one
114 of the following characters to specify a different unit other than a single
115 byte:
117 .ne 2
119 \fB\fBb\fR\fR
121 .RS 5n
122 512 bytes
126 .ne 2
128 \fB\fBk\fR\fR
130 .RS 5n
131 1-kilobyte
135 .ne 2
137 \fB\fBm\fR\fR
139 .RS 5n
140 1-megabyte
145 For backwards compatibility, \fB-number\fR is equivalent to \fB-n\fR number.
146 .SH OPTIONS
147 .SS "/usr/bin/head"
150 The following options are supported by \fB/usr/bin/head\fR:
152 .ne 2
154 \fB\fB-n\fR \fInumber\fR\fR
156 .RS 13n
157 The first \fInumber\fR lines of each input file is copied to standard output.
158 The \fInumber\fR option-argument must be a positive decimal integer.
162 .ne 2
164 \fB\fB-c\fR \fInumber\fR\fR
166 .RS 13n
167 The first \fInumber\fR bytes of each input file is copied to standard output.
168 The \fInumber\fR option-argument must be a positive decimal integer. Note,
169 output may end in the middle of a character if a file contains multi-byte
170 characters.
174 .ne 2
176 \fB\fB-\fR\fInumber\fR\fR
178 .RS 13n
179 The \fInumber\fR argument is a positive decimal integer with the same effect as
180 the \fB-n\fR \fInumber\fR option.
184 .ne 2
186 \fB-q\fR
188 .RS 13n
189 \fBhead\fR will not print a header in between each specified file.
193 .ne 2
195 \fB-v\fR
197 .RS 13n
198 \fBhead\fR will always print a header in between each specified file.
203 If no options are specified, \fBhead\fR acts as if \fB-n\fR \fB10\fR had been
204 specified.
205 .SS "ksh93"
208 The following options are supported by the head built-in command in
209 \fBksh93\fR:
211 .ne 2
213 \fB\fB-n\fR\fR
217 \fB\fB--lines=\fR\fIlines\fR\fR
219 .RS 18n
220 Copy lines from each file. The default value is \fB10\fR.
224 .ne 2
226 \fB\fB-c\fR\fR
230 \fB\fB--bytes=\fR\fIchars\fR\fR
232 .RS 18n
233 Copy \fIchars\fR bytes from each file.
237 .ne 2
239 \fB\fB-q\fR\fR
243 \fB\fB--quiet|silent\fR\fR
245 .RS 18n
246 Never output filename headers.
250 .ne 2
252 \fB\fB-s\fR\fR
256 \fB\fB--skip=\fR\fIskip\fR\fR
258 .RS 18n
259 Skip \fIskip\fR characters or lines from each file before copying.
263 .ne 2
265 \fB\fB-v\fR\fR
269 \fB\fB--verbose\fR\fR
271 .RS 18n
272 Always output filename headers.
275 .SH OPERANDS
278 The following operand is supported:
280 .ne 2
282 \fB\fB\fIfilename\fR\fR\fR
284 .RS 12n
285 A path name of an input file. If no \fIfile\fR operands are specified, the
286 standard input is used.
289 .SH EXAMPLES
291 \fBExample 1 \fRWriting the First Ten Lines of All Files
294 The following example writes the first ten lines of all files, except those
295 with a leading period, in the directory:
298 .in +2
300 example% \fBhead *\fR
302 .in -2
305 .SH ENVIRONMENT VARIABLES
308 See \fBenviron\fR(5) for descriptions of the following environment variables
309 that affect the execution of \fBhead\fR: \fBLANG\fR, \fBLC_ALL\fR,
310 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
311 .SH EXIT STATUS
314 The following exit values are returned:
316 .ne 2
318 \fB\fB0\fR\fR
320 .RS 6n
321 Successful completion.
325 .ne 2
327 \fB\fB>0\fR\fR
329 .RS 6n
330 An error occurred.
333 .SH ATTRIBUTES
336 See \fBattributes\fR(5) for descriptions of the following attributes:
337 .SS "/usr/bin/head"
342 box;
343 c | c
344 l | l .
345 ATTRIBUTE TYPE  ATTRIBUTE VALUE
347 CSI     Enabled
349 Interface Stability     Committed
351 Standard        See \fBstandards\fR(5).
354 .SS "ksh93"
359 box;
360 c | c
361 l | l .
362 ATTRIBUTE TYPE  ATTRIBUTE VALUE
364 Interface Stability     See below.
369 The \fBksh93\fR built-in binding to \fB/bin\fR and \fB/usr/bin\fR is Volatile.
370 The built-in interfaces are Uncommitted.
371 .SH SEE ALSO
374 \fBcat\fR(1), \fBksh93\fR(1), \fBmore\fR(1), \fBpg\fR(1), \fBtail\fR(1),
375 \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)