I've already shown you how to view files with the cat command. In today's post I'm going to show you how to use the GNU cat command for its originally intended purpose: for joining multiple files together.
For this example we'll need a couple of text files to start with. Paste the following text into a text editor and save it as file1.
item 1 item 2 item 3
Repeat the process with the following text and save it as file2.
item 4 item 5 item 6
You can verify the contents of your files by viewing them with cat.
Now you can use cat to join the contents of the two files and display it on the terminal.
To create a new file with the combined contents of the first two you simply use output redirection.
Now you can use cat again to view the contents of file3.
You should see
item 1 item 2 item 3 item 4 item 5 item 6