How to Unzip RAR Files in Linux: 10 Steps

Table of contents:

How to Unzip RAR Files in Linux: 10 Steps
How to Unzip RAR Files in Linux: 10 Steps
Anonim

Roshal ARchive (RAR) is a file format designed for data compression and storage. When you download a 'RAR' file from the web, you need to use a special program that allows you to decompress and access the data it contains. Since these types of programs are not included in most Linux distributions, you will need to install one. This article will tell you how to install Unrar and how to use it to decompress 'RAR' files in Linux.

Steps

Method 1 of 2: Install the Unrar Application

Unrar Files in Linux Step 1
Unrar Files in Linux Step 1

Step 1. Make sure your computer is connected to the internet

Unrar Files in Linux Step 2
Unrar Files in Linux Step 2

Step 2. Access a linux 'shell' window, if you are using the graphical interface (GUI)

  • You can open a 'shell' window using the key combination: 'Ctrl + alt="Image" + F1'.
  • Alternatively, you can launch a 'Terminal' window from the 'System Tools' folder.
  • All the commands you will find in the following steps will have to be typed inside the Linux 'shell' or the 'Terminal' window.
Unrar Files in Linux Step 3
Unrar Files in Linux Step 3

Step 3. Use the correct command to download unrar for your Linux installation

The following command requires 'root' user permissions, so you will need to log in using the 'su' (or 'sudo') command. Enter the necessary credentials to log in as 'root'.

  • Users using Linux Debian, should type the following command: 'apt-get install unrar' or 'apt-get install unrar-free'.
  • If you are using Fedora Core Linux, type the following command: 'yum install unrar'.
  • If you are using Arch Linux, install from another repository using the 'pacman -S unrar' command.
  • OpenBSD users will need to use the command: 'pkg_add –v –r unrar'.
  • Suse10 users will need to type: 'yast2 –i unrar'.
  • Suse11 users will need to type: 'zypper install unrar'.
Unrar Files in Linux Step 4
Unrar Files in Linux Step 4

Step 4. Download the installation package directly from rarlab if the above commands don't work

  • Type the command 'cd / tmp'.
  • Type 'wget
  • Unzip the file using the following command: 'tar -zxvf rarlinux-3.9.1.tar.gz'.
Unrar Files in Linux Step 5
Unrar Files in Linux Step 5

Step 5. Find the 'rar' and 'unrar' commands inside the 'rar' directory

  • Type the command 'cd rar'.
  • After that, use the './unrar' command.
Unrar Files in Linux Step 6
Unrar Files in Linux Step 6

Step 6. Copy the 'rar' and 'unrar' files to the '/ usr / local / bin' directory using the following command:

'cp rar unrar / usr / local / bin'. You will now be able to use the Unrar application within your Linux installation.

Method 2 of 2: Use the Unrar Application

Unrar Files in Linux Step 7
Unrar Files in Linux Step 7

Step 1. Extract all files (excluding directories) within the current directory using the 'unrar and file.rar' command

Unrar Files in Linux Step 8
Unrar Files in Linux Step 8

Step 2. View the list of files contained in the 'RAR' archive using the following command:

'unrar l file.rar'.

Unrar Files in Linux Step 9
Unrar Files in Linux Step 9

Step 3. Extract the files contained in the 'RAR' archive, keeping the full path, using the following command:

'unrar x file.rar'. This is probably the result you want to achieve.

Unrar Files in Linux Step 10
Unrar Files in Linux Step 10

Step 4. Verify the integrity of the archive using the 'unrar t file.rar' command

Advice

  • The 'RAR' file format supports data compression, error correction and 'file spanning', i.e. the ability to split a single RAR archive into multiple files.
  • If the RAR archive has been split into several files, they will be named as follows: [archive name].rar, [archive name].r00, [archive name].r01, [archive name].r02, etc… In this case, you will always have to refer to the main file ([archive name].rar). It will be the application that will automatically take care of rebuilding the main archive using all the files into which it was split.
  • 'RAR3' is the current format that identifies 'RAR' compressed archives. It has been provided with advanced data encryption functionality with 128 bit key. In addition, it can compress files larger than 4GB and handle 'Unicode' codenames.
  • Files in 'RAR' format can be created using commercial programs only, but can be decompressed using free programs, through the Linux tool that allows you to use the command line.
  • If you are not used to using the command line, and are looking for a program to manage 'RAR' files that has a graphical interface (GUI) compatible with your version of Linux, try using 'PeaZip'. PeaZip works with Gnome and KDE and is available in DEB or RPM formats.
  • File Roller (the default archive manager in Gnome-based Linux distributions) can use unrar as a tool to manage 'RAR' files. You simply need to install unrar in the '/ usr / local / bin /' directory (or equivalent), after which File Roller will automatically use unrar to decompress and access the 'RAR' format files.

Recommended: