How to Compress and Split Files in Ubuntu

In 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/movie/large-file.avi” and you want to compress, split and store the smaller files at the folder “/home/username/movie/split-flies/”, this is what you type in the terminal:

(change the filepath to where you want to keep the split files)

You will now see several files appearing at the “split-files” folder, each with file size of 650MB 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

and you can get the original file back.

Do you know of any other ways to compress and split files in Ubuntu?

Damien Damien

Damien Oh started writing tech articles since 2007 and has over 10 years of experience in the tech industry. He is proficient in Windows, Linux, Mac, Android and iOS, and worked as a part time WordPress Developer. He is currently the owner and Editor-in-Chief of Make Tech Easier.

8 comments

  1. You wrote “tar -xvf large-file.tar.bz”
    It should read “tar -xvjf large-file.tar.bz” because the tar file was compress with bzip2 and needs to be uncompressed with the same program.

    Another more optimal way would be:
    “cat large-file.tar.gz.* | tar -xvj”

  2. From looking around this also will work:

    split -d –bytes=104857600 file.rar

    and

    cat < file.rar.*

  3. Oops, I just noticed that in my comment it’s doing the same thing as what this tutorial says. I should pay better attention to the whole command next time. Thanks for this guide :D

  4. Is their a way to do this with 7zip using deflate64

    7z a -t=zip -mm=deflate64 archive.zip file

    is how you just zip a file. but how do you split it?

  5. Hi!
    I´m i newbie, who just installed ubuntu as my las chanche to recover my shit from my laptop to my external hdd.
    io don´t look tru these command.
    My File is an iso. and its in the directory: /media/Data/movies
    filename: HD12.iso
    How do i have to enter these command in the Terminal?
    Should it looks like this: (from the example above)
    cd movie/split-files tar -cvj /home/username/movie/large-files.avi | split -b 650m -d – “large-files.tar.bz.”
    Can somebody help me, and post the correct command.
    That would be very helpful!
    Thanx!

Comments are closed.