shell

Split a file

Sometimes you need split a file. For example, to send them attached to an email. For this, you can use the split command.

$ split -b 1m big_file file_part_

In the example, the big_file size is 10MB, the -b option split the file in 1MB pieces, and the file_part_ is the name given to the different parts.

$ ls file_part_*
file_part_aa    file_part_ac    file_part_ae    file_part_ag    file_part_ai
file_part_ab    file_part_ad    file_part_af    file_part_ah    file_part_aj

All the files are 1MB long.

For joining all the parts you can use the cat command.

cat file_part_* >> new_file

And new_file will be the same file as big_file.

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*Required Fields