cat's Examples

It will show content of given filename

It will show content of given filename

The cat command (short for “concatenate “) is one of the most frequently used commands in Linux. cat command allows you to create single or multiple files, view contents of file, concatenate files and redirect output in terminal or files.

$ cat file.txt
$ cat file1.txt file2.txt

it reads data from the file and fives their content as output

$cat filename

shows the contents of that file

$ cat/etc/passwd

shows the contents of bothe files

$ cat file file1

create a file

$cat>file2

create a file

$cat>file2

displays line numbers to the file

 

$ cat -n file1

shows the $ at the end of the line and in the gap between the paragraphs

$ cat -e file1

tab space is filled by ^i by usinf -T command

$cat -T file1

dispalys multiple files together

$ cat file 1 number.txt

This will create a file file2 and the output of the cat command is piped to sort and the result will be redirected to a newly created file.

$ cat file1 numbers.txt | sort file2

DevOpsSchool
Typically replies within an hour

DevOpsSchool
Hi there 👋

How can I help you?
×
Chat with Us