How to split and merge large files

Well, I faced this issue yesterday when I tried to copy a large image file to a FAT32 formatted USB adapter.

As we know the largest file that supported by FAT32 is 4GB, so I have to cut the file into pieces. How can I split a large file into a group of smaller ones?

With the help of split, this is quite easy. Basically we can have two ways to split large file, by size of by lines.

Here I will split files by size. Let us put 1.5GB per output file, the commend is:

$ split -b 1610612736 CentOS-6.5-x86_64-bin-DVD1.iso

This command will generate 3 files, xaa, xab, xac, as the file size is less then 4.5GB.

Then how can we merge these files?
It’s as easy as this command:

$ cat xa* > CentOS-6.5-x86_64-bin-DVD1.iso

We suppose you don’t have any other files that started with xa, otherwise you should change xa* to xa{a,b,c}

Share Button

Leave a comment

Your email address will not be published. Required fields are marked *