HomeCodeLinuxcat command in Linux/Unix
Linux commands

cat command in Linux/Unix

Unix/Linux cat command.

Linux cat command.

cat command is used to display the content of text files and to combine several files to one file.

The cat command does not accept directories.

cat command syntax

$ cat [options] file1 [file2...]

cat command options

cat command main options:

option description
cat -b add line numbers to non blank lines
cat -n add line numbers to all lines
cat -s squeeze blank lines to one line
cat -E show $ at the end of line
cat -T show ^I instead of tabs

cat command examples

View text file data:

$ cat list1.txtmilkbreadapples$ cat list2.txthousecar$

Combine 2 text files:

$ cat list1.txt list2.txtmilkbreadappleshousecar$

Combine 2 text files to another file:

$ cat list1.txt list2.txt > todo.txt$