19b50d902SRodney W. Grimes.\" Copyright (c) 1980, 1990, 1993 29b50d902SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 39b50d902SRodney W. Grimes.\" 49b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 59b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions 69b50d902SRodney W. Grimes.\" are met: 79b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 89b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 99b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 109b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 119b50d902SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 139b50d902SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 149b50d902SRodney W. Grimes.\" without specific prior written permission. 159b50d902SRodney W. Grimes.\" 169b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 179b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 189b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 199b50d902SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 209b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 219b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 229b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 239b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 249b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 259b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 269b50d902SRodney W. Grimes.\" SUCH DAMAGE. 279b50d902SRodney W. Grimes.\" 28*643ac419SXin LI.Dd June 12, 2022 299b50d902SRodney W. Grimes.Dt HEAD 1 3062500372SRuslan Ermilov.Os 319b50d902SRodney W. Grimes.Sh NAME 329b50d902SRodney W. Grimes.Nm head 339b50d902SRodney W. Grimes.Nd display first lines of a file 349b50d902SRodney W. Grimes.Sh SYNOPSIS 358fe908efSRuslan Ermilov.Nm 36*643ac419SXin LI.Op Fl qv 37bad33159SRuslan Ermilov.Op Fl n Ar count | Fl c Ar bytes 3847dec781SRuslan Ermilov.Op Ar 399b50d902SRodney W. Grimes.Sh DESCRIPTION 409b50d902SRodney W. GrimesThis filter displays the first 419b50d902SRodney W. Grimes.Ar count 42ef0e2ea4SAlexander Langerlines or 43ef0e2ea4SAlexander Langer.Ar bytes 44ef0e2ea4SAlexander Langerof each of the specified files, or of the standard input if no 459b50d902SRodney W. Grimesfiles are specified. 469b50d902SRodney W. GrimesIf 479b50d902SRodney W. Grimes.Ar count 489b50d902SRodney W. Grimesis omitted it defaults to 10. 499b50d902SRodney W. Grimes.Pp 5079490b93SKyle EvansThe following options are available: 5179490b93SKyle Evans.Bl -tag -width indent 5279490b93SKyle Evans.It Fl c Ar bytes , Fl -bytes Ns = Ns Ar bytes 5379490b93SKyle EvansPrint 5479490b93SKyle Evans.Ar bytes 5579490b93SKyle Evansof each of the specified files. 5679490b93SKyle Evans.It Fl n Ar count , Fl -lines Ns = Ns Ar count 5779490b93SKyle EvansPrint 5879490b93SKyle Evans.Ar count 5979490b93SKyle Evanslines of each of the specified files. 60*643ac419SXin LI.Pp 61*643ac419SXin LIBoth 62*643ac419SXin LI.Ar count 63*643ac419SXin LIand 64*643ac419SXin LI.Ar bytes 65*643ac419SXin LImay also be specified with size suffixes supported by 66*643ac419SXin LI.Xr expand_number 3 . 67*643ac419SXin LI.It Fl q , Fl -quiet , Fl -silent 68*643ac419SXin LISuppresses printing of headers when multiple files are being examined. 69*643ac419SXin LI.It Fl v , Fl -verbose 70*643ac419SXin LIPrepend each file with a header. 7179490b93SKyle Evans.El 7279490b93SKyle Evans.Pp 73*643ac419SXin LIIf more than a single file is specified, or if the 74*643ac419SXin LI.Fl v 75*643ac419SXin LIoption is used, each file is preceded by a 769b50d902SRodney W. Grimesheader consisting of the string 779b50d902SRodney W. Grimes.Dq ==> XXX <== 789b50d902SRodney W. Grimeswhere 799b50d902SRodney W. Grimes.Dq XXX 809b50d902SRodney W. Grimesis the name of the file. 81*643ac419SXin LIThe 82*643ac419SXin LI.Fl q 83*643ac419SXin LIflag disables the printing of the header in all cases. 84a866e170SRuslan Ermilov.Sh EXIT STATUS 85d628d776SRuslan Ermilov.Ex -std 86b16958a1SJoel Dahl.Sh EXAMPLES 87b16958a1SJoel DahlTo display the first 500 lines of the file 88b16958a1SJoel Dahl.Ar foo : 89b16958a1SJoel Dahl.Pp 90b16958a1SJoel Dahl.Dl $ head -n 500 foo 91b16958a1SJoel Dahl.Pp 92b16958a1SJoel Dahl.Nm 93b16958a1SJoel Dahlcan be used in conjunction with 94b16958a1SJoel Dahl.Xr tail 1 95b16958a1SJoel Dahlin the following way to, for example, display only line 500 from the file 96b16958a1SJoel Dahl.Ar foo : 97b16958a1SJoel Dahl.Pp 98b16958a1SJoel Dahl.Dl $ head -n 500 foo | tail -n 1 999b50d902SRodney W. Grimes.Sh SEE ALSO 100*643ac419SXin LI.Xr tail 1 , 101*643ac419SXin LI.Xr expand_number 3 1029b50d902SRodney W. Grimes.Sh HISTORY 1039b50d902SRodney W. GrimesThe 1048fe908efSRuslan Ermilov.Nm 1056fc8ba94SJuli Mallettcommand appeared in PWB UNIX. 106