Extracting and Opening RAR Files on Linux

This tutorial will show you how to open, create or extract RAR files within Linux.

unrar linux

A RAR file is a proprietary format for compressing and archiving files. As a non “free” format, some distributions will not have the unrar packages we will be using in its default repository.

unrar is a tool designed purely for extracting archives that utilize the RAR format. It is actively maintained by RARLAB and is offered as copyrighted but free software.

Over the following sections, we will explore how to get the unrar tool on your system and utilize it to extract a RAR archive.

This section will show you how to open or extract a RAR file on a Linux system. We will need to use a piece of software called “unrar” to open or extract these files.

Unrar is a terminal-based tool developed by RARLAB for extracting and opening RAR files on systems like Linux.

Installing unrar on Linux

Before you can use unrar to extract or open RAR files on your Linux system, you will need to install the package first.

In the following sections, we will show you how to install unrar using various package managers.

apt Package Manager (Debian, Ubuntu, etc)

1. Before installing the unrar package on systems that use the apt package manager, we need to perform an update.

By running the command below, you will update the cached package list.

2. Once the package list update completes, run the following command to install unrar to your Debian-based system.

dnf Package Manager (CentOS, RHEL)

1. Installing the unrar utility on Linux systems that use the dnf package manager is as straightforward as running the command below.

yum Package Manager (Fedora)

1. For systems that utilize the yum package manager, such as Fedora, you can install unrar to the operating system by using the command below.

sudo yum install unrar

pkg Package Manager (FreeBSD)

1. Finally, for FreeBSD it is possible to install the unrar utility by using the following command on

sudo pkg install unrar

The key usage of the unrar utility is to extract files from a RAR file. The most basic way to do this is to extract files without using the archived path.

By extracting without the archived path, unrar will extract all files to either the current working directory or the one you specify.

Below you can see the syntax for using the unrar utility to extract files from a RAR file on Linux.

Extracting a RAR file to the current directory on Linux is as straightforward as using “unrar” followed by the “e” option, then finally, the path to the file you want to extract.

Using the unrar utility like this on Linux will extract the files to your current working directory.

For example, to extract a RAR archive with the name “pimylifeup.rar“, we would use the following command.

Below is an example of what will be output after extracting an archive.

It is possible to extract files to a specific directory using the unrar tool on Linux.

All you need to do to achieve this is to specify a directory after the path to the file you want to extract.

For example, if we wanted to extract the contents of our “pimylifeup.rar” archive to the “/home/pimyubu/example” directory, we would use the command below.

With the result below, you can see that unrar extracted the files to the specified directory.

If your RAR archive contains archived paths for each file, you can use unrar to extract files to those paths.

Using unrar like this is a good way to restore files from a backup to their original positions.

To extract files like this, you need to replace the “e” option, with the “x” option, as shown in our example below.

Below you can see that the unrar tool extracted files back to where we originally archived them on our Linux system.

Please note, you will need to archive directories using a full path for this to work.

Listing the Content of a RAR File on Linux

You can use the unrar tool on Linux to list the contents of a RAR archive file.

To list files from inside a RAR archive you need to use the “l” option followed by the path to that particular archive.

Example of Listing Contents of a RAR File

To show how this works, let us use the following command to list the contents of the “pimylifeup.rar” RAR archive.

Below you can see that the unrar tool output the name of each file, its size, attributes, and the date it was last modified.

Testing a RAR File on Linux

You can also use the unrar utility on Linux to test the validity of a RAR archive. This functionality is useful for testing whether an archive has been corrupted.

To test whether a RAR file is valid, use the “t” option followed by the path to the archive you want to validate.

Example of Testing the Contents of a RAR Archive

To showcase how you can test the validity of a RAR archive, we will utilize it on our “pimylifeup.rar” archive.

All we need to do is use the “t” option, followed by the archive we want to validate.

The result below shows that unrar tested each file in our archive, and each was successfully validated.

Conclusion

At this point in the guide, you should know how to extract RAR files on Linux using the unrar utility.

Please comment below if you have any issues with extracting or viewing the contents of a RAR archive on Linux.

If you found this tutorial helpful, we have many guides that cover many other aspects of the Linux operating system.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Server Status

Aradippou Chat 1 Chat 2 Larnaca Limassol Nicosia

Chat Links

Official Links.

1. Chat 1.
2. Chat 2.

Alternative Mirror Links.

1. KiwiIRC 1.
2. KiwiIRC 2.

Other Web Clients.

1. IrcCloud.

Recent Posts

Related Posts:

Archives

Super Club Radio

Mighty Deals

CyIRC

CyIRC Tweets

Scroll Up