Split a 40 GB file into 5GB files

I would like to employ multiple connections to download a file from my server on the internet, the best way to do that is to split the file into 5GB chunks…

In linux, to split a file, i don’t need to decompress it then re-compress it in chunks, the easiest way is to use this command

split -b 5120MB file_to_split.bin

If you want the split parts to have a numeric suffix for example, try this, pay attention to the dot at the end which the numeric suffix will follow

split -d -b 9000m –suffix-length 3 myfile.zip myfile.zip.

The result to the above would be

myfile.zip.000 myfile.zip.001 myfile.zip.002 etc…

That’s it, happy downloading

Now, to put it back together (Assuming your system orders them correctly by name ;))

cat file_to_split.bin.* > file_to_split.bin

If it does not or your dont want to take any chances,

cat file_to_split.bin.000 file_to_split.bin.001 file_to_split.bin.003 > file_to_split.bin

To combine files split up with linux split on windows, you can use the copy command to concatenate them such as

copy /b xaa + xab + xac + xad + xae + xaf + xag + xah + xai resulting.tar.bzip2

Leave a Reply

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