How to split a gzip file to several small ones on Linux?

I have a very large (e.g. 100GB) .gz file and would like to split it into smaller files like 8GB/each for storage/copying. How to split a gzip file to several small ones on Linux?

asked Jun 24 by Eric Z Ma (42,250 points)

1 Answer

You may use the tool split to split a file by sizes.

An example to split a large.tgz to at most 8GB smaller files is as follows.

split -b 8G large.tgz large.tgz.part-

The split files names are the prefix with appendix like 'aa', 'ab', 'ac' as follows.

$ ll -h
total 35G
-rw-rw-r-- 1 user user  18G Jun 25 10:57 large.tgz
-rw-rw-r-- 1 user user 8.0G Jun 25 12:10 large.tgz.part-aa
-rw-rw-r-- 1 user user 8.0G Jun 25 12:15 large.tgz.part-ab
-rw-rw-r-- 1 user user 1.2G Jun 25 12:16 large.tgz.part-ac
answered Jun 25 by Eric Z Ma (42,250 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...