1.\" $NetBSD: cat.1,v 1.30 2003/08/27 16:27:35 junyoung Exp $ 2.\" 3.\" Copyright (c) 1989, 1990, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" This code is derived from software contributed to Berkeley by 7.\" the Institute of Electrical and Electronics Engineers, Inc. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. Neither the name of the University nor the names of its contributors 18.\" may be used to endorse or promote products derived from this software 19.\" without specific prior written permission. 20.\" 21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" SUCH DAMAGE. 32.\" 33.\" @(#)cat.1 8.3 (Berkeley) 5/2/95 34.\" 35.Dd May 2, 1995 36.Dt CAT 1 37.Os 38.Sh NAME 39.Nm cat 40.Nd concatenate and print files 41.Sh SYNOPSIS 42.Nm 43.Op Fl beflnstuv 44.Op Fl 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. 53A single dash represents the standard input, 54and may appear multiple times in the 55.Ar file 56list. 57.Pp 58The word 59.Dq concatenate 60is just a verbose synonym for 61.Dq catenate . 62.Pp 63The options are as follows: 64.Bl -tag -width Ds 65.It Fl b 66Implies the 67.Fl n 68option but doesn't number blank lines. 69.It Fl e 70Implies the 71.Fl v 72option, and displays a dollar sign 73.Pq Ql \&$ 74at the end of each line 75as well. 76.It Fl f 77Only attempt to display regular files. 78.It Fl l 79Set an exclusive advisory lock on the standard output file descriptor. 80This lock is set using 81.Xr fcntl 2 82with the 83.Dv F_SETLKW 84command. 85If the output file is already locked, 86.Nm 87will block until the lock is acquired. 88.It Fl n 89Number the output lines, starting at 1. 90.It Fl s 91Squeeze multiple adjacent empty lines, causing the output to be 92single spaced. 93.It Fl t 94Implies the 95.Fl v 96option, and displays tab characters as 97.Ql ^I 98as well. 99.It Fl u 100The 101.Fl u 102option guarantees that the output is unbuffered. 103.It Fl v 104Displays non-printing characters so they are visible. 105Control characters print as 106.Ql ^X 107for control-X; the delete 108character (octal 0177) prints as 109.Ql ^? . 110Non-ascii characters (with the high bit set) are printed as 111.Ql M- 112(for meta) followed by the character for the low 7 bits. 113.El 114.Sh EXIT STATUS 115The 116.Nm 117utility exits 0 on success, and \*[Gt]0 if an error occurs. 118.Sh SEE ALSO 119.Xr head 1 , 120.Xr hexdump 1 , 121.Xr lpr 1 , 122.Xr more 1 , 123.Xr pr 1 , 124.Xr tail 1 , 125.Xr view 1 , 126.Xr vis 1 , 127.Xr fcntl 2 128.Rs 129.%A Rob Pike 130.%T "UNIX Style, or cat -v Considered Harmful" 131.%J "USENIX Summer Conference Proceedings" 132.%D 1983 133.Re 134.Sh STANDARDS 135The 136.Nm 137utility is expected to conform to the 138.St -p1003.2-92 139specification. 140.Pp 141The flags 142.Op Fl belnstv 143are extensions to the specification. 144.Sh HISTORY 145A 146.Nm 147utility appeared in 148.At v1 . 149Dennis Ritchie designed and wrote the first man page. 150It appears to have been 151.Xr cat 1 . 152.Sh BUGS 153Because of the shell language mechanism used to perform output 154redirection, the command 155.Dq Li cat file1 file2 \*[Gt] file1 156will cause the original data in file1 to be destroyed! 157This is performed by the shell before 158.Nm 159is run. 160