O'Reilly logo

Mac OS X Tiger in a Nutshell by Jason McIntosh, Chuck Toporek, Chris Stone, Andy Lester

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

cat

Synopsis

cat [options] [files]

Reads one or more files and prints them on standard output. Reads 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.

Options

-b

Like -n, but don't number blank lines.

-e

Print a $ to mark the end of each line. Implies the -v option.

-n

Number lines.

-s

Squeeze out extra blank lines.

-t

Print each tab as ^I. Implies the -v option.

-u

Print output as unbuffered (default is buffered in blocks or screen lines).

-v

Display control characters and other nonprinting characters.

Examples

Display a file:

$ cat ch1

Combine files:

$ cat ch1 ch2 ch3 > all

Append to a file:

$ cat note5 >> notes

Create file at terminal; end with EOF:

$ cat > temp1

Create file at terminal; end with STOP:

$ cat > temp2 << STOP

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required