]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - bin/cat/cat.1
libfido2: update to 1.13.0
[FreeBSD/FreeBSD.git] / bin / cat / cat.1
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 .\"
34 .Dd January 29, 2013
35 .Dt CAT 1
36 .Os
37 .Sh NAME
38 .Nm cat
39 .Nd concatenate and print files
40 .Sh SYNOPSIS
41 .Nm
42 .Op Fl belnstuv
43 .Op Ar
44 .Sh DESCRIPTION
45 The
46 .Nm
47 utility reads files sequentially, writing them to the standard output.
48 The
49 .Ar file
50 operands are processed in command-line order.
51 If
52 .Ar file
53 is a single dash
54 .Pq Sq Fl
55 or absent,
56 .Nm
57 reads from the standard input.
58 If
59 .Ar file
60 is a
61 .Ux
62 domain socket,
63 .Nm
64 connects to it and then reads it until
65 .Dv EOF .
66 This complements the
67 .Ux
68 domain binding capability available in
69 .Xr inetd 8 .
70 .Pp
71 The options are as follows:
72 .Bl -tag -width indent
73 .It Fl b
74 Number the non-blank output lines, starting at 1.
75 .It Fl e
76 Display non-printing characters (see the
77 .Fl v
78 option), and display a dollar sign
79 .Pq Ql \&$
80 at the end of each line.
81 .It Fl l
82 Set an exclusive advisory lock on the standard output file descriptor.
83 This lock is set using
84 .Xr fcntl 2
85 with the
86 .Dv F_SETLKW
87 command.
88 If the output file is already locked,
89 .Nm
90 will block until the lock is acquired.
91 .It Fl n
92 Number the output lines, starting at 1.
93 .It Fl s
94 Squeeze multiple adjacent empty lines, causing the output to be
95 single spaced.
96 .It Fl t
97 Display non-printing characters (see the
98 .Fl v
99 option), and display tab characters as
100 .Ql ^I .
101 .It Fl u
102 Disable output buffering.
103 .It Fl v
104 Display non-printing characters so they are visible.
105 Control characters print as
106 .Ql ^X
107 for control-X; the delete
108 character (octal 0177) prints as
109 .Ql ^? .
110 .Pf Non- Tn ASCII
111 characters (with the high bit set) are printed as
112 .Ql M-
113 (for meta) followed by the character for the low 7 bits.
114 .El
115 .Sh EXIT STATUS
116 .Ex -std
117 .Sh EXAMPLES
118 The command:
119 .Pp
120 .Dl "cat file1"
121 .Pp
122 will print the contents of
123 .Pa file1
124 to the standard output.
125 .Pp
126 The command:
127 .Pp
128 .Dl "cat file1 file2 > file3"
129 .Pp
130 will sequentially print the contents of
131 .Pa file1
132 and
133 .Pa file2
134 to the file
135 .Pa file3 ,
136 truncating
137 .Pa file3
138 if it already exists.
139 See the manual page for your shell (e.g.,
140 .Xr sh 1 )
141 for more information on redirection.
142 .Pp
143 The command:
144 .Pp
145 .Dl "cat file1 - file2 - file3"
146 .Pp
147 will print the contents of
148 .Pa file1 ,
149 print data it receives from the standard input until it receives an
150 .Dv EOF
151 .Pq Sq ^D
152 character, print the contents of
153 .Pa file2 ,
154 read and output contents of the standard input again, then finally output
155 the contents of
156 .Pa file3 .
157 Note that if the standard input referred to a file, the second dash
158 on the command-line would have no effect, since the entire contents of the file
159 would have already been read and printed by
160 .Nm
161 when it encountered the first
162 .Sq Fl
163 operand.
164 .Sh SEE ALSO
165 .Xr head 1 ,
166 .Xr more 1 ,
167 .Xr pr 1 ,
168 .Xr sh 1 ,
169 .Xr tail 1 ,
170 .Xr vis 1 ,
171 .Xr zcat 1 ,
172 .Xr fcntl 2 ,
173 .Xr setbuf 3
174 .Rs
175 .%A Rob Pike
176 .%T "UNIX Style, or cat -v Considered Harmful"
177 .%J "USENIX Summer Conference Proceedings"
178 .%D 1983
179 .Re
180 .Sh STANDARDS
181 The
182 .Nm
183 utility is compliant with the
184 .St -p1003.2-92
185 specification.
186 .Pp
187 The flags
188 .Op Fl belnstv
189 are extensions to the specification.
190 .Sh HISTORY
191 A
192 .Nm
193 utility appeared in
194 .At v1 .
195 .An Dennis Ritchie
196 designed and wrote the first man page.
197 It appears to have been for
198 .Nm .
199 .Sh BUGS
200 Because of the shell language mechanism used to perform output
201 redirection, the command
202 .Dq Li cat file1 file2 > file1
203 will cause the original data in
204 .Pa file1
205 to be destroyed!
206 .Pp
207 The
208 .Nm
209 utility does not recognize multibyte characters when the
210 .Fl t
211 or
212 .Fl v
213 option is in effect.