How to Open Rar File in Linux

Yahya Irmak Feb 02, 2024
  1. Use unrar to Open rar File in Linux
  2. Use the unrar e Command to Extract File Contents of a rar File in Linux
  3. Use p7zip to Open rar File in Linux
How to Open Rar File in Linux

A rar file, also known as Roshal Archive Compressed, is a compressed file type containing multiple files and directories. Special programs are used to access and extract the contents of the rar file.

In this article, we will explain how to extract the contents of the rar file in Linux.

The tools required to open the rar file may not be installed in Linux. Let’s explain how to install and use these tools for different distributions.

Use unrar to Open rar File in Linux

We can install the unrar tool on Linux distributions with the following commands.

  1. Arch Linux/Manjaro
sudo pacman -S unrar
  1. Ubuntu/Debian
sudo apt-get install unrar
  1. Fedora
sudp dnf install unrar

Use the unrar e Command to Extract File Contents of a rar File in Linux

Use the unrar e command to open a rar file. Type the directory name to extract the file contents to a different directory.

unrar e test.rar /tmp

We can see that all the contents in the compressed file have been extracted to the specified directory.

Unrar extract

Use the unrar l Command to List File Contents of a rar File in Linux

With the l parameter, the file’s contents can be listed without extracting it.

unrar l test.rar

Unrar list

Use unrar t Command to Test File Contents of a rar File in Linux

With the t parameter, we can test the integrity of the file contents.

unrar t test.rar

Unrar test

Use p7zip to Open rar File in Linux

We can install the p7zip tool on Linux distributions with the following commands.

  1. Arch Linux / Manjaro
sudo pacman -S p7zip
  1. Ubuntu / Debian
sudo apt-get install p7zip
  1. Fedora / CentOS
sudo yum install p7zip

Use the 7z e Command to Extract File Contents of a rar File in Linux

Use the 7z e command to open a rar file. If you want to extract the file contents to a different directory, use the -o flag with the directory name.

7z e test.rar -o/tmp

We can see that all the contents in the compressed file have been extracted to the specified directory.

p7zip extract

Use the 7z l Command to List File Contents of a rar File in Linux

With the l parameter, the file’s contents can be listed without extracting it.

7z l test.rar

p7zip list

Use the 7z t Command to Test File Contents of a rar File in Linux

With the t parameter, we can test the integrity of the file contents.

7z t test.rar

p7zip test

Author: Yahya Irmak
Yahya Irmak avatar Yahya Irmak avatar

Yahya Irmak has experience in full stack technologies such as Java, Spring Boot, JavaScript, CSS, HTML.

LinkedIn

Related Article - Linux File