[Linux] Compress and split file or directory

On Linux, it is possible to compress anything and split the resulting archive with the split command

split -b SIZE - FILENAME_

Note that the trailing underscore _ isn't required but helps organizing the file names.

For example, to create an archive with tar and chunk it in 1KB pieces:

tar cz myFile | split -b 1KiB - out.tgz_

To decompress it, simply recreate the file with cat first:

cat FILENAME_* | tar xz


cat out.tgz_* | tar xz

No comments:

Post a Comment

With great power comes great responsibility.

Da grandi poteri derivano grandi responsabilità.