Split and join files

Some filesystems can't handle particularly large files. e.g. ISO 9660, used to store data on DVDs, has a 4Gb or 2Gb limit, depending on implementation.

To split a large file into smaller files:

split -b 1G -d [filename] [filename].

This will split the file into smaller files 1G in size, using a numerical suffix.

Example:

steph@slap ~ $ split -b 1G -d test.tgz test.tgz.
steph@slap ~ $ ls -lh
total 8G
-rwxrwx---  1 steph users 4.0G Sep  5 15:29 test.tgz
-rwxrwx---  1 steph users 1.0G Sep  5 18:09 test.tgz.00
-rwxrwx---  1 steph users 1.0G Sep  5 18:13 test.tgz.01
-rwxrwx---  1 steph users 1.0G Sep  5 18:17 test.tgz.02
-rwxrwx---  1 steph users 1.0G Sep  5 18:20 test.tgz.03

Join them back again:

cat [filename].* > [filename]

Example:

steph@slap ~ $ cat test.tgz.* > test.tgz
steph@slap ~ $ ls -lh
total 8G
-rwxrwx---  1 steph users 4.0G Sep  5 18:41 test.tgz
-rwxrwx---  1 steph users 1.0G Sep  5 18:09 test.tgz.00
-rwxrwx---  1 steph users 1.0G Sep  5 18:13 test.tgz.01
-rwxrwx---  1 steph users 1.0G Sep  5 18:17 test.tgz.02
-rwxrwx---  1 steph users 1.0G Sep  5 18:20 test.tgz.03

Last modified: 05/09/2008 Tags: (none)

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top