Name
cat
Synopsis
cat [options
] [files
]
Read one or more files and print them
on standard output. Read standard input if no
files are specified or if -
is specified as one of the files; end
input with EOF. Use the >
shell operator to combine several
files into a new file; >>
appends files to an existing file.
Solaris and Mac OS X Options
-
-b
Like
-n
, but don’t number blank lines.-
-e
Print a
$
to mark the end of each line. Must be used with-v
.-
-n
Number lines.
-
-s
Suppress messages about nonexistent files. (Note: on some systems,
-s
squeezes out extra blank lines.)-
-t
Print each tab as
^I
and each form feed as^L
. Must be used with-v
.-
-u
Print output as unbuffered (default is buffered in blocks or screen lines).
-
-v
Display control characters and other nonprinting characters.
GNU/Linux Options
-A
,--show-all
Same as
-vET
.-b
,--number-nonblank
Number all nonblank output lines, starting with 1.
-
-e
Same as
-vE
.-E
,--show-ends
Print
$
at the end of each line.-n
,--number
Number all output lines, starting with 1.
-s
,--squeeze-blank
Squeeze down multiple blank lines to one blank line.
-
-t
Same as
-vT
.-T
,--show-tabs
Print TAB characters as ^I.
-
-u
Ignored; retained for Unix compatibility.
-v
,--show-nonprinting
Display control and nonprinting characters, with the exception of LINEFEED and TAB.
Examples
cat ch1 Display a file cat ch1 ch2 ch3 > all Combine files cat note5 >> notes Append to a file cat > temp1 Create file at terminal; end with EOF cat > temp2 << STOPCreate file at terminal; end with STOP ...
Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.