2 .\" Copyright 1989 AT&T Copyright (c)
3 .\" 2008, Sun Microsystems, Inc. All Rights Reserved
4 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
5 .\" Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
6 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
7 .\" http://www.opengroup.org/bookstore/.
8 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
9 .\" This notice shall appear on any product containing this material.
10 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
11 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
12 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
13 .TH CAT 1 "Apr 8, 2008"
15 cat \- concatenate and display files
17 .SS "\fB/usr/bin/cat\fR"
20 \fB/usr/bin/cat\fR [\fB-nbsuvet\fR] [\fIfile\fR...]
26 \fBcat\fR [\fB-bdenstuvABDEST\fR] [\fIfile\fR...]
30 .SS "\fB/usr/bin/cat\fR"
33 The \fBcat\fR utility reads each \fIfile\fR in sequence and writes it on the
34 standard output. Thus:
38 example% \fBcat file\fR
45 prints \fIfile\fR on your terminal, and:
49 example% \fBcat file1 file2 >file3\fR
56 concatenates \fIfile1\fR and \fIfile2\fR, and writes the results in
57 \fIfile3\fR. If no input file is given, \fBcat\fR reads from the standard input
62 The \fBcat\fR built-in in \fBksh93\fR is associated with the \fB/bin\fR and
63 \fB/usr/bin\fR paths. It is invoked when \fBcat\fR is executed without a
64 pathname prefix and the pathname search finds a \fB/bin/cat\fR or
65 \fB/usr/bin/cat\fR executable. \fBcat\fR copies each file in sequence to the
66 standard output. If no file is specified, or if the file is \fB-\fR, \fBcat\fR
67 copies from standard input starting at the current location.
69 .SS "\fB/usr/bin/cat\fR"
72 The following options are supported by \fB/usr/bin/cat\fR:
79 Number the lines, as \fB-n\fR, but omit the line numbers from blank lines.
88 Precede each line output with its line number.
97 \fBcat\fR is silent about non-existent files.
106 The output is not buffered.
108 Buffered output is the default.
117 Non-printing characters, with the exception of tabs, NEWLINEs and form feeds,
118 are printed visibly. ASCII control characters (octal \fB000\fR \(mi \fB037\fR)
119 are printed as \fB^\fR\fIn,\fR where \fIn\fR is the corresponding ASCII
120 character in the range octal 100 \(mi 137 (@, A, B, C, . . ., X, Y, Z, [, \e,
121 ], ^, and _); the \fBDEL\fR character (octal \fB0177\fR) is printed \fB^?\fR.
122 Other non-printable characters are printed as \fBM-\fR\fIx,\fR where \fIx\fR is
123 the ASCII character specified by the low-order seven bits.
128 When used with the \fB-v\fR option, the following options can be used:
135 A \fB$\fR character is printed at the end of each line, prior to the NEWLINE.
144 Tabs are printed as \fB^I\fRs and form feeds to be printed as \fB^L\fRs.
149 The \fB-e\fR and \fB-t\fR options are ignored if the \fB-v\fR option is not
154 \fBksh93\fR \fBcat\fR supports the following options:
158 \fB\fB-b\fR \fB--number-nonblank\fR\fR
161 Number lines as with \fB-n\fR but omit line numbers from blank lines.
167 \fB\fB-d\fR \fB--dos-input\fR\fR
170 Open input files in text mode. Removes RETURNs in front of NEWLINEs on some
180 Equivalent to \fB-vE\fR.
186 \fB\fB-n\fR \fB--number\fR\fR
189 Insert a line number at the beginning of each line.
198 Equivalent to \fB-S\fR for \fBatt universe\fR and \fB-B\fR otherwise.
207 Equivalent to \fB-vT\fR.
213 \fB\fB-u\fR \fB--unbuffer\fR\fR
216 Do not delay the output by buffering.
222 \fB\fB-v\fR \fB--show-nonprinting\fR\fR
225 Cause non-printing characters (with the exception of TABs, NEWLINEs, and form
226 feeds) to be output as printable character sequences. \fBASCII\fR control
227 characters are printed as \fB^n\fR, where \fIn\fR is the corresponding
228 \fBASCII\fR character in the range octal \fB100\fR-\fB137\fR. The DEL character
229 (octal \fB0177\fR) is copied as \fB^?\fR. Other non-printable characters are
230 copied as \fBM-\fR\fIx\fR where \fIx\fR is the \fBASCII\fR character specified
231 by the low-order seven bits. Multi-byte characters in the current locale are
232 treated as printable characters.
238 \fB\fB-A\fR \fB--show-all\fR\fR
241 Equivalent to \fB-vET\fR.
247 \fB\fB-B\fR \fB--squeeze-blank\fR\fR
250 Replace multiple adjacent NEWLINE characters with one NEWLINE.
256 \fB\fB-D\fR \fB--dos-output\fR\fR
259 Open output files in text mode. Insert RETURNs in front of NEWLINEs on some
266 \fB\fB-E\fR \fB--show-ends\fR\fR
269 Insert a \fB$\fR before each NEWLINE.
275 \fB\fB-S\fR \fB--silent\fR\fR
278 \fBcat\fR is silent about non-existent files.
284 \fB\fB-T\fR \fB--show-blank\fR\fR
287 Copies TABs as \fB^I\fR and form feeds as \fB^L\fR.
293 The following operand is supported:
300 A path name of an input file. If no \fIfile\fR is specified, the standard input
301 is used. If \fIfile\fR is \fB\|\(mi\|\fR, \fBcat\fR reads from the standard
302 input at that point in the sequence. \fBcat\fR does not close and reopen
303 standard input when it is referenced in this way, but accepts multiple
304 occurrences of \fB\|\(mi\|\fR as \fIfile\fR.
310 See \fBlargefile\fR(5) for the description of the behavior of \fBcat\fR when
311 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
314 \fBExample 1 \fRConcatenating a File
317 The following command writes the contents of the file \fBmyfile\fR to standard
323 example% \fBcat myfile\fR
329 \fBExample 2 \fRConcatenating Two files into One
332 The following command concatenates the files \fBdoc1\fR and \fBdoc2\fR and
333 writes the result to \fBdoc.all\fR.
338 example% \fBcat doc1 doc2 > doc.all\fR
344 \fBExample 3 \fRConcatenating Two Arbitrary Pieces of Input with a Single
348 When standard input is a terminal, the following command gets two arbitrary
349 pieces of input from the terminal with a single invocation of \fBcat\fR:
354 example% \fBcat start - middle - end > file\fR
361 when standard input is a terminal, gets two arbitrary pieces of input from the
362 terminal with a single invocation of \fBcat\fR.
366 If standard input is a regular file,
371 example% \fBcat start - middle - end > file\fR
378 would be equivalent to the following command:
383 \fBcat start - middle /dev/null end > file\fR
390 because the entire contents of the file would be consumed by \fBcat\fR the
391 first time \fB\|\(mi\|\fR was used as a \fIfile\fR operand and an end-of-file
392 condition would be detected immediately when \fB\|\(mi\|\fRwas referenced the
395 .SH ENVIRONMENT VARIABLES
398 See \fBenviron\fR(5) for descriptions of the following environment variables
399 that affect the execution of \fBcat\fR: \fBLANG\fR, \fBLC_ALL\fR,
400 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
404 The following exit values are returned:
411 All input files were output successfully.
426 See \fBattributes\fR(5) for descriptions of the following attributes:
427 .SS "\fB/usr/bin/cat\fR"
435 ATTRIBUTE TYPE ATTRIBUTE VALUE
439 Interface Stability Committed
441 Standard See \fBstandards\fR(5).
452 ATTRIBUTE TYPE ATTRIBUTE VALUE
454 Interface Stability See below.
459 The \fBksh93\fR built-in binding to \fB/bin\fR and \fB/usr/bin\fR is Volatile.
460 The built-in interfaces are Uncommitted.
464 \fBtouch\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5),
469 Redirecting the output of \fBcat\fR onto one of the files being read causes the
470 loss of the data originally in the file being read. For example,
474 example% \fBcat filename1 filename2 > filename1\fR
481 causes the original data in \fBfilename1\fR to be lost.