Extract RAR File in Ubuntu
What is RAR File?
RAR is the proprietary archive file format that provides its support for file spanning, error recovery, and data compression. In 1993, it was developed by Eugene Roshal (a Russian software engineer) and the software was licensed via win.rar. The RAR term is an abbreviation for Roshal Archive.
A RAR file is an archive that includes multiple files compressed using RAR compression. It's compressed using a high compression ratio as compared to a typical ZIP compression and consolidates an algorithm of proprietary compression used by other compressors such as 7-Zip for 7Z files. RAR archives are often used for transferring or storing files since they store files in a decreased size.
Note: Almost all file extensions can be pronounced as their single letters but RAR is treated as a term itself and called "Rahr".
File Format of RAR
The RAR filename extensions are .rev for recovery volume set and .rar for data volume set. Older RAR versions split bigger archives into many smaller files and make a "multi-volume archive". Also, the numbers were utilized in the smaller file's file extensions for keeping them in an accurate order. The first file utilized the .rar extension, then the .r00 extension for the second, and then the .r01, .r02 extensions, etc.
RAR compression libraries and applications (including GUI-based application of WinRAR for Windows and console utility for distinct operating systems and others) are the proprietary programs, to which Alexander L. Roshal owns the copyright. RAR version 3 is based on PPM (Prediction by Partial Matching) and Lempel-Ziv compression.
The minimum RAR file size is 20 bytes and the maximum size is 9,223,372,036,854,775,807 bytes which are 9000 PB.
The revision history of the RAR file format:
Extract RAR files in Ubuntu
RAR is a tool that is freely available and pre-installed on Windows OSes but unfortunately does not support the platform of Linux. If we will attempt extracting on Ubuntu, the archive manager will display us a dialogue box.
We can go through the following methods to see how we can install the tools of RAR in Ubuntu and use those to create, extract, and compress the files.
Installing Unrar tool in Ubuntu
Unrar is mostly compatible with Linux distributions where we can easily install a package using the command terminal with the apt programs.
(We can delete "x64" from the command if we wish to edit it for a 32-bit system.)
How to install RAR in Ubuntu
We need to enter the below commands in the terminal window for installing the RAR command option:
How to create RAR files in Ubuntu
We will need to execute the below command for creating a .rar file in Ubuntu:
It will establish a 'filename' archive file name for the filename1 directory.
How to remove files from an archive
If you want to remove a specific file out of more than one file within an archive, we need to enter the below command in the terminal window:
How to recover removed archives
If we removed an archive file mistakenly or lost it by data loss, do not worry because we can recover it. The below command will recover that file or will set it if there has been any damage or loss:
Extract RAR file
We need to enter the below command in the terminal Window for opening or extracting a .rar extension file in our current working directory.
It will begin extracting our file with the help of the Unrar tool.
Important: We can also implement these operations with the right-click, besides applying these commands in the terminal window because we have the tool, i.e., Unrar.
We need to enter the below command in the terminal window for opening or expecting a .rar extension file in any particular directory or path. It will extract those files and place them in that directory:
If we wish to open or extract the .rar extension files in their actual directory, we can use the below command:
Viewing content in a RAR file in Ubuntu
A compressed file includes more than one file of bigger sizes that are zipped inside it together. If we wish to list out every file content in an archive file, we can use the following command. The command will show a file list with their name, time, size, permissions, and date created.
How to test a RAR file in Ubuntu
If we have downloaded any file for instance through the internet and wish to check its integrity, the Unrar tool provides that facility as well. The below command will do a full test on the archive file and then display the results:
The tool, i.e., unrar that we just installed applies the unrar command for carrying out the above operations. It enables us to extract, test, and list out the files. Options to create a rar file are not available with this specific tool. Hence, we will install other Linux command-line utilities which are known as RAR for creating archive/compressed files.