Every regular Linux user must know how to install and use UnRAR on Ubuntu 20.04 OS. Keep reading to find out all about it.
UnRAR is a command-line utility for extracting RAR files. While RAR is a free utility for handling compressed files under Windows operating systems, sadly, it is not pre-installed on Linux computers.
So for this article, we are going to start with a brief discussion on what a RAR file is and the other standard compressed file formats. We will also discuss the basic features of a RAR file and provide an introduction to the UnRARunrar utility.
Furthermore, we shall discuss the installation instructions for the UnRAR utility. Along with some of UnRAR’s common commands like extracting or listing down a RAR file’s contents, opening a password-protected file, and more.
What is RAR?
The Roshal Archive (RAR) is a file format for storing compressed data files. These are compressed archives similar to other formats, such as .tar, .gz, or .zip files. It has the following features:
- It was developed in 1993 by Eugene Roshal
- It is licensed by win.rar GmbH
- It is a proprietary data format
- Besides data compression, it also supports error correction and file spanning
- They can be used to split a file into multiple files, which can then be combined later on
The UnRAR utility
RAR is one of the most widely used archive formats. But unfortunately, the Ubuntu operating system doesn’t support extracting or creating RAR files. When you try to open a RAR file in Ubuntu, you will see the following message appearing:
For opening files in Ubuntu, the UnRAR utility can be used. We will now discuss the installation of the UnRAR utility on Ubuntu. For following the steps ahead, some prerequisites must be met. First, you must have an Ubuntu operating system (OS) installed. Second, you should have a root account or an account with sudo privileges.
How to Install and Use UnRAR on Ubuntu 22.04 using the APT Package Manager
Follow the steps below to install the UnRAR utility.
Update your system
The very first step is to update your system packages. Click on the System Menu and then select Terminal to open it. Then, type the following command on the Terminal to update your system packages:
$sudo apt update -y && sudo apt upgrade –y
To install UnRAR, type the following command on your Terminal:
$sudo apt install unrar-free –y
It will take a while to install the UnRAR utility on your system.
Usage of UnRAR software
Before moving on to the next part, we will discuss the primary uses of the UnRAR command.
List the contents in a RAR file
The first step while using a RAR archive is to see the contents or files in the RAR file. For this purpose, we can use the
–t flag. Type the following command on your Terminal to see the list of files present in the archive:
$unrar -t [filename.rar]
Extract a file to the current directory using UnRAR
Using the UnRAR utility, you can extract or open a RAR file present in the current folder. To extract a file, use the
UnRAR –x command as follows:
$unrar -x [file-name.rar]
In the above command,
-x stands for extract, and file-name.rar is the file name you want to extract.
Extract a file to a specified destination using UnRAR software
You can also specify the destination folder where you want to extract the file as follows:
$unrar -x [file-name.rar] /path/you/want/to/extract/to/
Pulling only new files while extracting
While extracting a file, you should pull only new files in the archive. For this purpose, use the following command:
$unrar --extract-newer [filename.rar]
The –f flag for overwriting an existing file
While extracting a file, the destination may have some older files present. You should overwrite these files. For this purpose, use the following command:
$unrar -f [filename.rar]
Extracting a password-protected file
You can extract a password-protected RAR file. For this purpose, the following command can be used:
$unrar -p [filename.rar]
Uninstallation of UnRAR software
The uninstallation of the software may be required when the software is not working correctly, or a new version or an alternate software is available. So, if you want to remove the UnRAR software, you can use the following command to uninstall it:
$sudo apt autoremove unrar-free --purge –y
And there you have it, we have discussed the installation of the UnRAR utility.
In this article, we first discussed the UnRAR tool and its importance. Then we talked about the installation instructions using the apt package manager. Followed up with a brief overview of how to extract files in the current directory or a specific destination.
We also covered how to overwrite existing files and extract password-protected RAR files. Lastly, wrapped everything up by discussing how to uninstall the UnRAR utility. If you have any questions regarding the UnRAR tool, don’t hesitate to leave a comment below,
If this guide helped you, please share it.