Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

cat

v0.13.0
cat [OPTION]... [FILE]...

Concatenate FILE(s), or standard input, to standard output With no FILE, or when FILE is -, read standard input.

Options

--show-all, -A

equivalent to -vET

--number-nonblank, -b

number nonempty output lines, overrides -n

-e

equivalent to -vE

--show-ends, -E

display $ at end of each line

--number, -n

number all output lines

--squeeze-blank, -s

suppress repeated empty output lines

-t

equivalent to -vT

--show-tabs, -T

display TAB characters at ^I

--show-nonprinting, -v

use ^ and M- notation, except for LF (\n) and TAB (\t)

-u

(ignored)

Examples

Print the contents of a file to stdout:

cat {{path/to/file}}

Concatenate several files into an output file:

cat {{path/to/file1 path/to/file2 ...}} >{{path/to/output_file}}

Append several files to an output file:

cat {{path/to/file1 path/to/file2 ...}} >>{{path/to/output_file}}

Write to a file interactively:

cat >{{path/to/file}}

Number all output lines:

cat {{[-n|--number]}} {{path/to/file}}

Display all characters, including tabs, line endings, and non-printing characters:

cat {{[-A|--show-all]}} {{path/to/file}}

Omit repeating empty lines:

cat {{[-s|--squeeze-blank]}} {{path/to/file}}

Pass file contents to another program through stdin:

cat {{path/to/file}} | {{program}}

The examples are provided by the tldr-pages project under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.