cat

From Juneday education
Jump to: navigation, search


Description

cat - concatenate files and print on the standard output.

On this page we only give you a short introduction with a few examples. We encourage you to read the manual (man cat).


"cat is a standard Unix utility that reads files sequentially, writing them to standard output. The name is derived from its function to concatenate files. " cat

Example output

Output a file's content

$ cat file.txt
Hi there folks

This is a simple text file

.... and here it ends

Read from stdin

$ cat
By typing this text and pressing enter cat will read this line
By typing this text and pressing enter cat will read this line
and output it....
and output it....
Pressing control-d makes bash close the stream (stdin)
Pressing control-d makes bash close the stream (stdin)

Read from stdin and redirect to file

$ cat > file.txt
Hi there

This is just some text 
 
/John Doe

.. don't forget to press control-d