cat command

(concatenate files)

The cat command can be used to join multiple files together and print the result on screen.

One dictionary definition of concatenate is "to connect or link in a series or chain"

Lets say we have a file called 01.txt which is a simple text file containing the text "this is the text in file 01", and another file called 02.txt containing the text "this is the text in file 02". If we run cat on file 01 we get the following result.

> cat 01.txt
this is the text in file 01

If we run the cat command on both files, we get this...

> cat 01.txt 02.txt
this is the text in file 01
this is the test in file 02

You can see the cat has printed the contents of both files.

If no file is named, the standard input (usually the keyboard) is printed on screen (also known as 'standard output').

Back to command index

Subscribe to us on YouTube