User:Jmbabich/Split

= Splitting Large Files in Linux =

Use the standard GNU/Linux command split to divide a huge file, such as a video file, into smaller chunks, suitable for emailing using a webmail service such as GMail.

For example, if you have a video clip named mov00023.mpg, which is 93 megabytes (MB) long, you can split it into multiple smaller chunks with a maximum size of 10MB. The last chunk is almost always smaller than the maximum size.

Note: The maximum size in this example is 10MB. It could just as easily have been 3MB or 20MB.

Splitting the File
The procedure to split this file is as follows:

Step One
Go to the command line interface in a terminal session by selecting

Applications --> System Tools --> Terminal

Step Two
At the command prompt, type the following:

split --bytes=10m mov00023.mpg mymov00023

where

specifies that each output file is 10 MB in size,

is the name of the input file being split, and

is the prefix for the multiple split output files.

This will create a group of related files named:

mymov00023aa

mymov00023ab

mymov00023ac

mymov00023ad

...

etc.

For example, if the file is 93 MB, the split command will create nine 10MB files and one 3MB file, with suffixes from "aa" to "aj", for a total of ten files.

The output files will be created in the same folder in which the command is issued. The current folder can be determined by typing pwd at the command prompt.

The output files will not have file extensions, such as mpg. This is the normal result.

Step Three
Mail each 10 MB file as a separate file attachment. Be sure to tell the recipient the name of the original huge file.

Putting It All Back Together
On the receiving end, the email recipient gets a series of emails with 10MB attachments. Use the cat standard utility to put the chunks back together.

To reassemble the original file, move the chunks into a common folder and type the following command in a terminal session:

cat mymov00023* > mov00023.mpg

The output file, following the ">" sign, will be named mov00023.mpg and be 93MB in size.