How to Compress and Split Files in Ubuntu 9.10

3 11 2009

split_filesIn Ubuntu, the Archive Manager (or file-roller) has make it easy for anyone to compress and zip up a file or folder, but if you have a large file, say 20Gb, and you want to back it up to the CD/DVD, you will find that no amount of compression can you reduce the file size to fit into 1 CD/DVD. In such case, it is a better solution to compress and split the large file into several smaller files and store them separately. This also applies if you want to share a large file on a file-sharing site. Splitting the compressed file into several smaller files will make it easier for others to download.

Let’s say that the large file is a movie file found in /home/username/films/large-file.avi and you want to compress, split and store the smaller files at the folder /home/username/films/split-flies/, this is what you type in the terminal:

cd films/split-files (change the filepath to where you want to keep the split files)

 tar -cvj /home/username/films/large-files.avi | split -b 640m -d – “large-files.tar.bz.”

You will now see several files appearing at the split-files folder, each with file size of 640MB and with filenames large-files.tar.bz.00, large-files.tar.bz.01, large-files.tar.bz.02, etc.

To recover and extract the split files, type

cat large-files.tar.bz.* > large-files.tar.bz
 tar -xvj large-file.tar.bz

and you can get the original file back.


Actions

Information

Leave a comment