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
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.
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.