community man page

cat

Print and concatenate files.

12 examples·source: tldr · CC-BY·status: verified
Reading is open to everyone. Suggesting a flag, fixing an example or adding a recipe is opening to verified-email accounts soon — every change is moderated before it goes live.
curl https://curlhub.sh/man/cat
same page, in your terminal

Examples

Print the contents of a file to `stdout` GNU

cat path/to/file

Concatenate several files into an output file GNU

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

Append several files to an output file GNU

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

Write to a file interactively GNU

cat > path/to/file

Number all output lines GNU

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

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

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

Pass file contents to another program through `stdin` GNU

cat path/to/file | program

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

Copy the contents of a file into an output file without buffering

cat -u /dev/tty12 > /dev/tty13

Write `stdin` to a file

cat - > path/to/file