Split a large file in Linux

Print

Q. I am trying to move a large file, but I want to split it into chunks.

A. This can be done in using by piping the file into a split command (this also gzips the file):

Split

gzip -c largefile | split -b 512MiB - largefile_split.gz_

This will create a bunch of files:

largefile_split.gz_aa

largefile_split.gz_ab

largefile_split.gz_ac

etc...

Combine

Combining the file on the other side:

cat largefile_split.gz_* | gunzip -c > largefile

and that's it.

 

Linux