MakeTechEasier
  • Home
  •  
  • About
  •  
  • Archives
  •  
  • Jobs
  •  
  • Advertise
  •  
  • Contact Us
  • Windows
  • Linux
  • Mac
  • Internet
  • WordPress
  • iPhone
  • Android
  • All Categories
    • Android RSS
    • Firefox RSS
    • Gaming RSS
    • Google RSS
    • google chrome RSS
    • Internet RSS
    • iPhone/iPod Touch RSS
    • Linux RSS
    • Mac RSS
    • Mobile RSS
    • OpenOffice RSS
    • PC Hardware RSS
    • Review RSS
    • Roundup RSS
    • Windows RSS
    • Windows Mobile RSS
    • WordPress RSS
    • WordPress Plugins RSS
  • rss icon
  • email icon
  • facebook icon
  • twitter icon

How to Compress and Split Files in Ubuntu

Posted by: Damien on October 6th, 2008
  • 11 Comments
  • Share

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:

cd movie/split-files (change the filepath to where you want to keep the split files)
tar -cvj /home/username/movie/large-files.avi | split -b 650m -d – “large-files.tar.bz.”

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

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

and you can get the original file back.

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


Damien Oh is the owner and chief editor of Make Tech Easier

Tags: compress, Linux, split, Ubuntu
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Share and Enjoy!

  • Rss feed
  • StumbleUpon It!
  • Del.icio.us
  • reddit

Related Posts

  • Create a Private Encrypted Folder On Ubuntu Hardy With eCryptfs
  • How To Install Dreamweaver CS3 In Ubuntu Hardy
  • Maximize Your Terminal Usage with Terminator
  • How to Convert .FLAC to .MP3 In Ubuntu
  • How to Install Software from a Tarball in Linux

Popular Posts

  • Turn Your Ubuntu Hardy to Mac OSX Leopard 498 comment(s)
  • Turn Your Ubuntu Intrepid Into Mac OSX Leopard 311 comment(s)
  • 28 Coolest Firefox About:Config Tricks 122 comment(s)
  • How To Boot And Install Windows 7 From USB Flash Drive 122 comment(s)
  • Best 101 Free Computer Software For Your Daily Use 101 comment(s)

Enjoyed the article? Subscribe to Make Tech Easier today to get your daily updates of technology tutorials, tips and tricks.

Enter your email:

3 pingbacks/trackbacks (Click to open)

  • 8 Ways to Maintain a Clean, Lean Ubuntu Machine - Make Tech Easier
  • How to Split Files in Ubuntu « TTC Shelbyville - Technical Blog
  • Mel The Geek and More… » 8 Ways to Maintain a Clean, Lean Ubuntu Machine
[Click to close]

11 Responses

  • qiet72 says:
    October 13, 2008 at 9:46 am

    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”

    Reply
  • Damien says:
    October 13, 2008 at 3:12 pm

    @qiet72: Yes. You are correct. Thanks for spotting and pointing out the error.

    Reply
  • Joel says:
    June 1, 2009 at 8:16 am

    From looking around this also will work:

    split -d –bytes=104857600 file.rar

    and

    cat < file.rar.*

    Reply
  • Joel says:
    June 3, 2009 at 3:17 am

    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

    Reply
  • lance says:
    December 11, 2009 at 12:19 pm

    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?

    Reply
  • Florian Urban says:
    January 6, 2010 at 5:21 pm

    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!

    Reply
    • Damien says:
      January 9, 2010 at 2:48 am

      First, create a folder call “spilt-files” in the Movies folder.

      Enter the following command in the terminal:

      cd ~/Movies/spilt-files
      tar -cvj /media/Data/movies/HD12.iso | split -b 650m -d – “large-files.tar.bz.”

      Reply
      • Florian Urban says:
        January 17, 2010 at 2:47 pm

        THX !!!

        Reply
Cancel reply

Leave a Comment




Comment

Please Note: Comments maybe under moderation after you submit your comments so there is no need to resubmit your comment again

write for MTE

Latest Posts

  • OfficeMedium – A Social Collaboration Platform For The Small Business + Free Promotions
  • MakeTechEasier Is Now Hosted On KnownHost
  • KTorrent: KDE’s BitTorrent client
  • How to Create a Customized Toolbar for Your Browser
  • 13 Ways To Customize Ubuntu Netbook Remix For Better Usability

Our Writers

  • Damien Oh - Chief Editor
  • Sharninder - Geeky Ninja
  • Joshua Price
  • Tavis J. Hampton - Lantern Torch
  • Shevonne Polastre - FreeAgentWriter
  • Trevor Dobrygoski
  • Soumen Halder - Ampercent
  • Tanmay Ahmed - Tech-Tips-Geek
Make Tech Easier on Facebook
Jobs by SimplyHired
Job Widgets

Copyright

All the articles (including the text, images and tutorials) are properties of MakeTechEasier.

You cannot copy whole tutorials, either in English or translate to another language without our permission.

Write for us

Writing a tutorial or article for MakeTechEasier is a great way to get exposure and give back to the community.

Read More Details

Suggestions

We need your help to help us serve you better! This is YOUR site, so if you have suggestions/feedbacks on how we can improve it for you, please let us know! We do our best to make this place better!

Make a Suggestion

Navigation

  • Home
  • About Us
  • Advertise
  • Archives
  • Contact Us

Copyright © 2007-2010 Make Tech Easier | All Right Reserved.