Linux cat command

cat command is used to combine several files, display the contents of file and create a file.

Syntax:

cat > filename –> To create new file
cat filename –> Read data from file
cat < filename --> Read data from file
cat >> filename –> Add data to existing file

Options:

Option Description
-A show-all
-b number-nonblank
-e,-E show-ends
-n number
-s squeeze-blank
-T show-tabs
-v show-nonprinting

Examples:

To create a new file:

cat > test1
Welcome to k2schools
Then press ctrl+D to save the file.

Linux cat command

To display the content of the file:

cat < test.txt or cat test.txt

Linux cat command2

To append the data to existing file:

cat >> test.txt
In k2schools.com website, you get the information of following technologies
sybase, oracle, linux, ….etc.
(press ctrl+d to save the file)

Linux cat command1

Powered by k2schools
Skip to toolbar