~/CyberRef$


Cat

Cat, short for concatenate, is often used to print text in the terminal from files. It may also be used to combine and create files.

Tip: The tac command displays files in reverse order of cat!


Printing a File in the Terminal

If you have attempted any capture the flag challenges, you've likely used the cat command to print a flag out:

cat flag.txt

The above command would display the full text of flag.txt in the terminal.

Creating a File with Cat

You may touch to create a new file, or use cat like so:

cat > myPoem.txt

Type the text you would like saved into your file in the terminal. Use shift+enter if you need a line break in your file. Press CTRL+D to save the changes.

Combine Files

Lastly, you may combine files using:

cat firstFile secondFile > combinedThirdFile

Reference

https://www.geeksforgeeks.org/linux-unix/cat-command-in-linux-with-examples/