How to split and merge files into one in Ubuntu Linux using Split and Cat

Ubuntu is one of the most versatile open source operating systems with the largest number of tools available today. This system allows you to perform a wide range of operations thanks to the functions that Ubuntu has or could have. One of them and very interesting is that it is possible to install packages or programs from the terminal.

One of these functions that Ubuntu offers you is that of be able to split and merge files easily using the tools that the Unix program. This will allow certain configurations and tools to be able to manage your files if you request it using the Split and Cat instruments.




Not sure how to use these tools? Don't worry, we love helping anyone who needs to know how things are done, so keep reading this article.

We will show you with a simple method how to merge and split files in Ubuntu using the tools that Unix provides, since you were that in a couple of minutes you will know how to use and some features of Unix.

What is Split on Unix?

How to split and merge files into one in Ubuntu Linux using Split and Cat

It's a command program that has been a great tool for operating systems like Unix, as it allows you to split a file into smaller files. In case you cannot find your file, you can try to search for the files with the command.

It does this kind of division of a code file using an extension found in the program to be able to manage the size of the split files.

In this way, Split allows you to view more orderly the scope and detailed characteristics of each partition. That's why it's called Split because translated from English it means leaving.



It is capable of generating up to files up to 1000 lines. And for example, the output files are named by adding aa, ab, ac and so on. And as for the output files, the names are used by adding x, such as xaa, xab and so on.


When used as an input file, they can be read from standard input. If you want to go deeper into the features of Split, you can use Man Split to get a better look at the details. In case you want to merge the files again, the Cat command is activated.

What is the Cat Command System?

How to split and merge files into one in Ubuntu Linux using Split and Cat

The name of this control system comes from the word concatenate, which translated into Spanish is concatenar, that substantially it means to unite. In other words, in a nutshell, this system will allow you to merge files and view them very easily. This will allow you to rejoin the files you split with Split.

This program will write everything the files contain to standard output, organizing them in the same order they were given, and print the files to standard output.

Having already the basic knowledge of what these systems will be used in the process, let's see the steps to follow to split and merge Ubuntu files.

What are the steps to split and merge files with Split and Cat?

How to split and merge files into one in Ubuntu Linux using Split and Cat

Once you are clear enough on how the programs work Split and Cat command, it will be much easier for you to split and merge files on your Linux system. Let's start with the procedure:



If you want divide a file called test.7z of 500Mb in size in several 100Mb files, then you have to type the following command:

  • $ split -b 100m tes.7z divided

When you do this, you will see how it returns the 100 Mb files derived from the original file. The name it will have will be divisoaa, divisoab and so on.

If the file you added has the –d parameter, the filenames will be different as it would use numbers, for example it will have names like divide01, divide02, and so on. And the command you will use is:


  • $ split -b -d 100m tes.7z divided

You will already have your files split, but if you want join them again, you simply need to run the following command in the location of the files:

  •  $ cat split *> testUnido.7z

And so, by following these steps, which are quite simple and very easy to follow, you will be able to split and merge files in Linux.

TagsLinux
add a comment of How to split and merge files into one in Ubuntu Linux using Split and Cat
Comment sent successfully! We will review it in the next few hours.