fix worst-case buffer sizes for non-blocking I/O
[unix-history] / usr / src / bin / cat / cat.1
CommitLineData
b5dc1377 1.\" Copyright (c) 1989, 1990 The Regents of the University of California.
ea642694 2.\" All rights reserved.
e8cca28c 3.\"
cf136d2c
KB
4.\" This code is derived from software contributed to Berkeley by
5.\" the Institute of Electrical and Electronics Engineers, Inc.
6.\"
27c71911 7.\" %sccs.include.redist.man%
ea642694 8.\"
cf136d2c 9.\" @(#)cat.1 6.16 (Berkeley) %G%
e8cca28c 10.\"
b5dc1377
CL
11.Dd
12.Dt CAT 1
13.Os BSD 3
14.Sh NAME
15.Nm cat
16.Nd concatenate and print files
17.Sh SYNOPSIS
18.Nm cat
19.Op Fl benstuv
20.Op Fl
bf40f8ff 21.Op Ar
b5dc1377 22.Sh DESCRIPTION
ea642694 23The
b5dc1377 24.Nm cat
ea642694 25utility reads files sequentially, writing them to the standard output.
334f3902 26The
b5dc1377 27.Ar file
ea642694
KB
28operands are processed in command line order.
29A single dash represents standard input.
b5dc1377 30.Pp
49c5b53c 31The options are as follows:
bf40f8ff
CL
32.Bl -tag -width Ds
33.It Fl b
49c5b53c 34Implies the
b5dc1377 35.Fl n
49c5b53c 36option but doesn't number blank lines.
bf40f8ff 37.It Fl e
49c5b53c 38Implies the
b5dc1377 39.Fl v
bf40f8ff
CL
40option, and displays a dollar sign
41.Pq Ql \&$
42at the end of each line
49c5b53c 43as well.
bf40f8ff 44.It Fl n
49c5b53c 45Number the
b5dc1377 46.Ar output
49c5b53c 47lines, starting at 1.
bf40f8ff 48.It Fl s
49c5b53c
KB
49Squeeze multiple adjacent empty lines, causing the output to be
50single spaced.
bf40f8ff 51.It Fl t
49c5b53c 52Implies the
b5dc1377 53.Fl v
bf40f8ff
CL
54option, and displays tab characters as
55.Pq Ql ^I
56as well.
57.It Fl u
334f3902 58The
5325ced3
CL
59.Fl u
60option guarantees that the output is unbuffered.
bf40f8ff 61.It Fl v
49c5b53c 62Displays non-printing characters so they are visible.
bf40f8ff
CL
63Control characters print line
64.Ql ^X
65for control-X; the delete
66character (octal 0177) prints as
67.Ql ^?
49c5b53c 68Non-ascii characters (with the high bit set) are printed as
bf40f8ff
CL
69.Ql M-
70(for meta) followed by the character for the low 7 bits.
71.El
b5dc1377 72.Pp
0351bf1a
KB
73The
74.Nm cat
75utility exits 0 on success, and >0 if an error occurs.
76.Sh BUGS
ea642694 77Because of the shell language mechanism used to perform output
bf40f8ff
CL
78redirection, the command
79.Dq Li cat file1 file 2 > file1
0351bf1a 80will cause the original data in file1 to be destroyed!
b5dc1377
CL
81.Sh SEE ALSO
82.Xr head 1 ,
83.Xr more 1 ,
84.Xr pr 1 ,
85.Xr tail 1
bf40f8ff
CL
86.Rs
87.%A Rob Pike
88.%T "UNIX Style, or cat -v Considered Harmful"
89.%J "USENIX Summer Conference Proceedings"
90.%D 1983
91.Re
b5dc1377 92.Sh HISTORY
bf40f8ff 93A
b5dc1377 94.Nm
bf40f8ff 95command appeared in Version 6 AT&T UNIX.