Tips Linux Explorers   All Things Linux Forum   Great Linux Links   Hometown    


Split is a command we use for splitting large files into smaller ones without corrupting the integrity of the file. We can later merge the files again to the original size.
Why would we want to do that ? Well, an example would be if your laptop only has a floppy drive and you want to copy a large file from your PC to your laptop.

This is how it works:

# split -b1m lastweek.mp3 lastweek.mp3.

( The first ¨lastweek.mp3¨ is the original file, while the second ¨lastweek.mp3.¨ is the name of the new files, the last dot has to be there for the double extension, or else it won't work. The -b stands for bytes, the ¨1m¨ means in portions of 1 MB . You can use -l instead of -b, then it will be the number of lines, the default is 1,000 lines )

If the original file was 5.6 MB you will get 6 files named: , lastweek.mp3.aa, lastweek.mp3.ab,,, and ( the last one only 0.6MB )

Merging them together on the laptop is quite simple too:

$ cat lastweek.mp3.* >lastweek.mp3

( don't forget the * )

That's all, so now you've got a spotless lastweek.mp3 of 5.6 MB on the laptop.


Yarg mailed us, "I found the windows command that would successfully combine the files":

# copy/b file1+file2+file3 newfile

-- Aug 22 2003 ( Revised Jan 28 2006 ) --

Tips Linux Explorers   All Things Linux Forum   Great Linux Links   Hometown