Beginner Package: coreutils

cat

Print file contents to the screen, or join files together.

Syntax

cat [options] file...

Description

cat (short for "concatenate") is most often used to quickly display a short file, but it can also join several files together into one, or be combined with output redirection to create a new file.

Examples

cat file.txt
Print the contents of a file
cat file1.txt file2.txt > combined.txt
Join two files into a new one
cat -n file.txt
Print with line numbers

Applies to

Ubuntu Debian Linux Mint RHEL CentOS / Rocky / AlmaLinux Fedora Arch Linux openSUSE Alpine Linux