xref: /openbsd/usr.bin/head/head.1 (revision 09467b48)
1.\"	$OpenBSD: head.1,v 1.23 2015/10/25 21:50:32 zhuk Exp $
2.\"
3.\" Copyright (c) 1980, 1990 The Regents of the University of California.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"	from: @(#)head.1	6.6 (Berkeley) 7/24/91
31.\"
32.Dd $Mdocdate: October 25 2015 $
33.Dt HEAD 1
34.Os
35.Sh NAME
36.Nm head
37.Nd display first few lines of files
38.Sh SYNOPSIS
39.Nm head
40.Op Fl Ar count | Fl n Ar count
41.Op Ar
42.Sh DESCRIPTION
43The
44.Nm
45utility copies the first
46.Ar count
47lines of each specified
48.Ar file
49to the standard output.
50If no files are named,
51.Nm
52copies lines from the standard input.
53If
54.Ar count
55is omitted, it defaults to 10.
56.Pp
57The options are as follows:
58.Bl -tag -width Ds
59.It Fl Ar count | Fl n Ar count
60Copy the first
61.Ar count
62lines of each input file to the standard output.
63.Ar count
64must be a positive decimal integer.
65.El
66.Pp
67If more than one file is specified,
68.Nm
69precedes the output of each file with the following, in order
70to distinguish files:
71.Pp
72.Dl ==> Ar file No <==
73.Sh EXIT STATUS
74.Ex -std head
75.Sh EXAMPLES
76To display the first 500 lines of the file
77.Ar foo :
78.Pp
79.Dl $ head -n 500 foo
80.Pp
81.Nm
82can be used in conjunction with
83.Xr tail 1
84in the following way to, for example, display only line 500 from the file
85.Ar foo :
86.Pp
87.Dl $ head -n 500 foo | tail -1
88.Sh SEE ALSO
89.Xr cat 1 ,
90.Xr cut 1 ,
91.Xr less 1 ,
92.Xr more 1 ,
93.Xr tail 1
94.Sh STANDARDS
95The
96.Nm
97utility is compliant with the
98.St -p1003.1-2008
99specification.
100.Pp
101The historic syntax
102.Fl Ar count
103is supported by this implementation.
104.Sh HISTORY
105The
106.Nm
107utility first appeared in
108.Bx 1 .
109.Sh AUTHORS
110.An Bill Joy ,
111August 24, 1977.
112