Use "cat" to merge multiple files


The "cat" command is mostly used for viewing files but not many people know that the original purpose of this command is for merging files together ("cat" is the abbreviation of "catenate", which means " to connect things together").

The syntax to use "cat" to merge multiple files is very simple. Suppose you have a sample file1 like this:
 11111  
 11111  

And a sample file2 like this:
 22222  
 22222  

And a sample file3 like this:
 33333  
 33333  

To merge the three sample files above into a new file4, the command you can use will be:
 cat file1 file2 file3 > file4

After that, you will have the file4 like this:
 11111  
 11111  
 22222  
 22222  
 33333  
 33333  
linux tips and tricks