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