+3 votes
240 views
How to split and combine files in Linux?

in Linux / Unix by (552k points)
recategorized by | 240 views

1 Answer

+4 votes
Best answer

What is split?
What is cat?
How files are divided and joined in Linux using split and cat

Dividing and joining files in Linux is a fairly simple task that will allow us to fragment a file into several smaller files, this often helps us to fragment files that occupy a lot of memory space, either to transport it in external storage units or for security policies such as keeping fragmented and distributed copies of our data. For this simple process we will use two important split and cat commands.

What is split?

It is a  command for Unix systems   that allows us to divide a file into several smaller ones, it creates a series of files with the extension and a correlative of the name of the original file, being able to parameterize the size of the resulting files.

To delve into the scope and characteristics of this command we can run man split where we can see its detailed documentation

What is cat?

On the other hand, the cat of linux command  allows to concatenate and show files, in an easy and efficient way, that is, with this command we can visualize various text files and we can also concatenate divided files.

In the same way that with split we can visualize the detailed documentation of cat with the command man cat.

How files are divided and joined in Linux using split and cat

Once you know the basics of the split and cat commands, it will be fairly easy to split and merge files into linux. For a general example where we want to divide a file called test.7z that weighs 500 mb in several 100mb files, we should simply execute the following command:

$ split -b 100m tes.7z dividido

This command will return 5 files of 100 mb resulting from the original file, which will have the name divided, divided, and so on. It is worth noting that if we add the -d  parameter  to the previous instruction, the name of the resulting files would be numeric, that is, divided01, divided02 ...

$ split -b -d 100m tes.7z dividido

Now, to unite again the files that we have divided, just execute from the directory where the files are stored the following command:

$ cat dividido* > testUnido.7z

With these small but simple steps we can divide and join files in Linux in a simple and easy way, I hope you like it and see you in a future article.


by (3.5m points)
selected by

Related questions

+5 votes
1 answer
+3 votes
1 answer
asked May 22, 2019 in Linux / Unix by backtothefuture (552k points) | 197 views
+3 votes
1 answer
+5 votes
1 answer
asked Jun 23, 2019 in Linux / Unix by backtothefuture (552k points) | 229 views
+3 votes
1 answer
asked May 22, 2019 in Linux / Unix by backtothefuture (552k points) | 297 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users