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