1.\"- 2.\" Copyright (c) 1989, 1990, 1993 3.\" The Regents of the University of California. All rights reserved. 4.\" 5.\" This code is derived from software contributed to Berkeley by 6.\" the Institute of Electrical and Electronics Engineers, Inc. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 3. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)cat.1 8.3 (Berkeley) 5/2/95 33.\" $FreeBSD: src/bin/cat/cat.1,v 1.27 2006/12/23 09:25:23 ru Exp $ 34.\" $DragonFly: src/bin/cat/cat.1,v 1.6 2007/02/04 21:08:28 pavalos Exp $ 35.\" 36.Dd March 21, 2004 37.Dt CAT 1 38.Os 39.Sh NAME 40.Nm cat 41.Nd concatenate and print files 42.Sh SYNOPSIS 43.Nm 44.Op Fl benstuv 45.Op Ar 46.Sh DESCRIPTION 47The 48.Nm 49utility reads files sequentially, writing them to the standard output. 50The 51.Ar file 52operands are processed in command-line order. 53If 54.Ar file 55is a single dash 56.Pq Sq Fl 57or absent, 58.Nm 59reads from the standard input. 60If 61.Ar file 62is a 63.Ux 64domain socket, 65.Nm 66connects to it and then reads it until 67.Dv EOF . 68This complements the 69.Ux 70domain binding capability available in 71.Xr inetd 8 . 72.Pp 73The options are as follows: 74.Bl -tag -width indent 75.It Fl b 76Number the non-empty output lines, starting at 1. 77.It Fl e 78Display non-printing characters (see the 79.Fl v 80option), and display a dollar sign 81.Pq Ql \&$ 82at the end of each line. 83.It Fl n 84Number the output lines, starting at 1. 85.It Fl s 86Squeeze multiple adjacent empty lines, causing the output to be 87single spaced. 88.It Fl t 89Display non-printing characters (see the 90.Fl v 91option), and display tab characters as 92.Ql ^I . 93.It Fl u 94Disable output buffering. 95.It Fl v 96Display non-printing characters so they are visible. 97Control characters print as 98.Ql ^X 99for control-X; the delete 100character (octal 0177) prints as 101.Ql ^? . 102.Pf Non- Tn ASCII 103characters (with the high bit set) are printed as 104.Ql M- 105(for meta) followed by the character for the low 7 bits. 106.El 107.Sh EXIT STATUS 108.Ex -std 109.Sh EXAMPLES 110The command: 111.Pp 112.Dl "cat file1" 113.Pp 114will print the contents of 115.Pa file1 116to the standard output. 117.Pp 118The command: 119.Pp 120.Dl "cat file1 file2 > file3" 121.Pp 122will sequentially print the contents of 123.Pa file1 124and 125.Pa file2 126to the file 127.Pa file3 , 128truncating 129.Pa file3 130if it already exists. 131See the manual page for your shell (i.e., 132.Xr sh 1 ) 133for more information on redirection. 134.Pp 135The command: 136.Pp 137.Dl "cat file1 - file2 - file3" 138.Pp 139will print the contents of 140.Pa file1 , 141print data it receives from the standard input until it receives an 142.Dv EOF 143.Pq Sq ^D 144character, print the contents of 145.Pa file2 , 146read and output contents of the standard input again, then finally output 147the contents of 148.Pa file3 . 149Note that if the standard input referred to a file, the second dash 150on the command-line would have no effect, since the entire contents of the file 151would have already been read and printed by 152.Nm 153when it encountered the first 154.Sq Fl 155operand. 156.Sh SEE ALSO 157.Xr head 1 , 158.Xr more 1 , 159.Xr pr 1 , 160.Xr sh 1 , 161.Xr tail 1 , 162.Xr vis 1 , 163.Xr zcat 1 , 164.Xr setbuf 3 165.Rs 166.%A Rob Pike 167.%T "UNIX Style, or cat -v Considered Harmful" 168.%J "USENIX Summer Conference Proceedings" 169.%D 1983 170.Re 171.Sh STANDARDS 172The 173.Nm 174utility conforms to 175.St -p1003.2-92 176and 177.St -p1003.1-2004 . 178.Pp 179The flags 180.Op Fl benstv 181are extensions to the specification. 182.Sh HISTORY 183A 184.Nm 185utility appeared in 186.At v1 . 187.An Dennis Ritchie 188designed and wrote the first man page. 189It appears to have been 190.Xr cat 1 . 191.Sh BUGS 192Because of the shell language mechanism used to perform output 193redirection, the command 194.Dq Li cat file1 file2 > file1 195will cause the original data in 196.Pa file1 197to be destroyed! 198.Pp 199The 200.Nm 201utility does not recognize multibyte characters when the 202.Fl t 203or 204.Fl v 205option is in effect. 206