Linux cat

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Linux cat command

The 'cat' command is the most universal and powerful tool. It is considered to be one of the most frequently used commands. It can be used in many types as given below.

Linux cat command: to display file content

The 'cat' command can be used to display the content of a file.

Syntax:

cat <fileName>

Example:

  1. cat jtp.txt  

Linux cat Display

In the above snapshot, file 'jtp.txt' is displayed with the help of command "cat jtp.txt".

Note: To display content of multiple files at once, type file names in one single line like "cat file1 file2 file3....

Linux cat command usage

Option Function
cat > [fileName] To create a file.
cat [oldfile] > [newfile] To copy content from older to new file.
cat [file1 file2 and so on] > [new file name] To concatenate contents of multiple files into one.
cat -n/cat -b [fileName] To display line numbers.
cat -e [fileName] To display $ character at the end of each line.
cat [fileName] < Used as page end marker.