Thursday, January 28, 2010

Splitting a File into Smaller Pieces

On occasion, there will be a need to split a file up into smaller pieces for easier transportation. Be it email, FTP, CD's, or any other method. Here's how to do it with the split command.


$ split -b 1024m large_file.tbz chunk-



This will produce the following files:


-rwxr--r-- 1 owner group 1073741824 Jan 28 19:00 chunk-aa
-rwxr--r-- 1 owner group 134987776 Jan 28 19:00 chunk-ab


And to assemble them back into one piece, it's just as easy:


$ cat chunk-* >> large_file.tbz


--DRH

No comments: