How to Install unrar on Debian 12

The unrar is the command utility that is used to extract the files with the .rar extension. This command line tool is open source because of which users can access it and make amendments to the software according to their requirements. 

The RAR files are the compressed archives that can be helpful to reduce the size of the file and these reduced-size files are not only useful in sending them through email but also occupy less memory space on the computer. 

The unrar command line tool does not come pre-installed on Debian Linux but it can be installed with the method explained in this post following the outline:

  1. What is the Installation Method for unrar on Debian Linux
  2. How to Use the unrar on Debian
  3. What are the Examples of using the unrar Command on Debian
  4. How to Uninstall the unrar on Debian

Let’s begin with the post and explore the method to install unrar on Debian. 

What is the Installation Method for unrar on Debian Linux?

Though the unrar package does not come pre-installed on Debian 12, it is available in the default repository of Debian by the following steps. 

Step 1: Start the Debian’s Terminal

First, start the terminal either from the application’s menu or with the usage of its shortcut key:

Step 2: Find the unrar Package

Now confirm the availability of the “unrar” package in the default repository of Debian by running the command:

$ sudo apt show unrar-free

The output confirms the availability of the “unrar” package in Debian’s default repository. 

Step 3: Update the Package

Update the packages and upgrade them to make sure all the packages are up to date:

$ sudo apt update

Step 4: Install unrar on Debian 

Finally, install the present package of the “unrar” in Debian’s default repository with the command:

$ sudo apt install unrar-free -y

Step 5: Verify the unrar’s Installation

To confirm the installation of the unrar package on Debian 12, display its installed version:

$ unrar -V

The output validates the installation of unrar on Debian 12. 

How to Use the unrar on Debian?

The unrar command line tool is used to extract the archive files with the following general syntax:

$ unrar [Options] Archive_File [Destination]

In the above command, users can use different unrar’s options according to the application. Then specify the file name that is supposed to be extracted. Lastly, users can also extract the file in the particular directory as well. 

Different options of the unrar command can be explored by displaying its help parameter with the command:

$ unrar --help

All the options of the unrar have been explained on the screen. 

What are the Examples of using the unrar Command on Debian?

Various examples have been used to explain the usage of the unrar command following the general syntax explained in the previous section. 

Example 1: List the Content of the  Zipped File

To list down the contents of the rar archive without extracting it, use the “t” option of the “unrar” command:

$ unrar -t sample-1.rar

Example 2: Extract the File to the Specific Destination

In this example, extract the rar file using the unrar command to the /Downloads directory:

$ unrar sample-1.rar /home/itsinuxfoss/Downloads/

Example 3: Extract the  Zipped File

To extract the contents of the rar file in the current directory, run the command:

$ unrar sample-1.rar

How to Uninstall the unrar on Debian 12?

The unrar command line tool can be uninstalled and removed from Debian 12 with all its files by executing the command:

$ sudo apt purge unrar-free -y

Also, remove the unused dependencies on the Debian 12 with the following command:

$ sudo apt autoremove -y

This is all about the installation, usage, and uninstallation of the unrar on Debian 12.

Conclusion

The unrar command utility can be installed on Debian by executing the command “sudo apt install unrar -y” in its terminal. The unrar command is used to extract the rar archives on Debian 12 and also on other Linux distributions,

This blog covers everything about the installation, usage, and uninstallation of the unrar command on Debian 12.