Tag Archives: cat

Split and join large files using cat, split and tar

I was going to store a CentOS DVD iso file into my external hard drive but the image was bigger than 4GB, the biggest file size in FAT32, so I had to split it.

$ cat CentOS-6.5-x86_64-bin-DVD1.iso | split -b 2200m - CentOS-6.5-x86_64-bin-DVD1.iso-part-

This will generate files, each one of 2.2GB (except the last one that will be smaller), with these names:

CentOS-6.5-x86_64-bin-DVD1.iso-part-aa
CentOS-6.5-x86_64-bin-DVD1.iso-part-ab

You can join them with cat:

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

tar-split

You may also split and compress it on the fly with tar and it’s z option:

$ tar cvzf - CentOS-6.5-x86_64-bin-DVD1.iso | split -b 2200m - CentOS-6.5-x86_64-bin-DVD1.tar.gz-part-

And of course decompress and join:

$ cat CentOS-6.5-x86_64-bin-DVD1.tar.gz-part-* | tar xvzf -