HxHippy

cat

Concatenate and display file content

Overview

Displays the content of files, or concatenates files and prints on the standard output.

Syntax

cat [OPTION]... [FILE]...

Common Options

-n, --number

Number all output lines.

-b, --number-nonblank

Number nonempty output lines, overrides -n.

-s, --squeeze-blank

Suppress repeated empty output lines.

-E, --show-ends

Display $ at end of each line.

-T, --show-tabs

Display TAB characters as ^I.

Examples

$ cat myfile.txt

Displays the content of myfile.txt.

$ cat file1.txt file2.txt

Displays the concatenated content of file1.txt and file2.txt.

$ cat file1.txt file2.txt > newfile.txt

Concatenates file1.txt and file2.txt and writes the output to newfile.txt.

$ cat -n script.sh

Displays the content of script.sh with line numbers.

$ cat /etc/os-release

Displays information about the operating system.

concatenatedisplayviewfilecontentcat