Command Line

How To: Extract An .rar File

Today, we’re going to learn how to extract an .rar file in Linux. You don’t see .rar files all that often with Linux, but sometimes they crop up. Today’s article will explain how to extract them.

You may recall .rar files from your Windows days, assuming you have a history with Windows – as many of us Linux users do. You’d probably be most familiar with the application known as ‘WinRAR‘. 

While the application is specifically for Windows (there’s a text-based WinRAR for Linux, perhaps a subject for another article), it produces files compressed with the .rar format. The .rar compression is much like any other compression, from .tar.gz to .zip. At some point, you may be faced with opening one while you’re using Linux.

Just because the files are often made with WinRAR doesn’t mean the files will only be opened in Windows. Once in a while, you’ll find something you need that’s in .rar format and you’re using Linux. Well, fear not, you can extract an .rar file easily enough. It’s just a simple terminal command away and you should be all set. While not a skill you’ll need often, it’s one you’ll maybe need and now is a good enough time to learn how.

Extract An .RAR File:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Once you have the terminal open, you’ll need to install an application called ‘unrar’. If you’re using a major distro, it’s likely in your repository – though maybe under the name of ‘unrar-nonfree’. Search your repositories and you’ll find it.

If you’re using Debian/Ubuntu/similar then it’s easy enough – it’s called ‘unrar’ and you install it with:

sudo apt install unrar

With that installed, the next part is really quite easy:

unrar x /path/to/file.rar

That will extract the contents of the .rar file while preserving paths. If you don’t care about that sort of result, just use the ‘e’ flag like this (and it’ll extract everything to the current directory):

unrar e /path/to/file.rar

You can also extract password protected content easily enough, just read the man pages with man unrar to learn how. Anything you can do with a GUI you can do with the terminal. You just need to read the man page. This article only covers how to extract an .rar file without any complexity.

Closure:

That’s it. That’s today’s article. The goal was to learn how to extract an .rar file in Linux and now you know how to do so with unrar and the Linux terminal. ‘Snot all that complicated, really.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Recent Posts

View Detailed Hardware Information

There are many tools for showing your hardware information and today we'll get to view…

2 days ago

How To: Install Wine In Lubuntu

Today's article isn't going to be complicated or long as we are going to cover…

4 days ago

Update Python Packages (PIP)

We've had a run of Python packages recently and you can tell that I'm a…

6 days ago

Save A Command’s Output To A File (While Showing It In The Terminal)

The title is the best I can come up with to describe this exercise as…

1 week ago

Demystifying journalctl: A Comprehensive Guide to Linux System Logging

It was suggested that I write an article about journalctl, which seemed like a large…

1 week ago

Extract Text From Multiple File Types

Today we will have a fairly simple exercise as we're going to just use a…

2 weeks ago