Ubuntu rar

RAR is a popular proprietary file format and software for compressing and archiving files, known for its ability to span multiple RAR files into a single archive, which is useful for compressing, archiving, and transferring large files.

Linux, including Ubuntu, has had RAR support for some time, but due to RAR's proprietary licensing and restrictions support comes through multiple programs. Luckily all of them are easy to install, and if you don't particularly care for the license you might just want to install them all in one go, especially unrar-nonfree and rar, and enjoy complete support for all RAR files, and all operations it allows you to do.

The following are the relevant programs and what they support, by their package names:

  • unrar-free – opens some .rar files, does not support RAR v3.
  • unrar-nonfree – opens all RAR files.
  • unar – an alternative option with full RAR support
  • 7zip – supports opening and extracting rar files
  • rar – a program for both creating and extracting rar archives

That about sums up what we've got, in addition to graphical archiving applications that use the support of some of these programs to handle rar files, among others.

Now let's try to keep it simple. If you just want the ability to open and extract all rar files, and also easily create rar archives then install unrar-nonfree and rar using the Ubuntu Software Center or with these simple apt-get command:

sudo apt-get install unrar-nonfree rar

With this stuff behind the scenes your Ubuntu can now do anything you want with rar files, right from the File Manager itself. Just right-click on any .rar file and choose "Extract.." and you're done. Or if you want to compress some files just select them, right click, and choose "Compress…". Then pick .rar from the list of formats and click "Create". You can then also use File Roller, Ark, and similar programs with rar files as well.

If you prefer to decompress with the command line here are a few basic examples to get you started. To extract an existing .rar archive run the rar command with the "e" function, which stands for "extract":

rar e pictures.rar

You can also use the unrar command the same way:

unrar e pictures.rar

To create a new archive run rar with the "a" function, standing for "add" or "archive", like this:

rar a pictures.rar Pictures/

You can also add multiple files into the archive:

rar a pictures.rar picture1.jpg picture2.jpg picture3.jpg

And just to make things slightly more interesting here's how to create multipart rar archives, those that take the original big file and compress it into multiple .part01.rar, .part02.rar etc. files.

rar a -v50M movie.rar movie.mp4

The "-v50M" tells rar that each rar part will be 50 megabytes in size. You can put any size here. For example if you want 5 MB for each part you would type "-v5M" instead. Extracting these files works the same way as extracting any other archive except you have to extract the first part, the .part01.rar, like this:

rar e movie.part01.rar

It will then take data from all the parts and put it together into the original file.

For more information you can consult the manual pages for rar by running man rar. Don't mind it saying "this is a trial version". It's the same kind of perpetual trial as WinRAR on Windows.

And that's how you roll with rar on Ubuntu.