RAR is a proprietary compressed file format developed by Eugene Roshal. The command used to extract RAR files is Unrar. By default, the Unrar command is not installed on Linux, FreeBSD, and UNIX. Therefore, you can install the Unrar command using the apt-get or yum command.
Installing the unrar command
For those using Debian or Ubuntu Linux, you can easily install unrar using the command apt-get or apt as shown below:
$ sudo apt-get install unrar
Alternatively:
$ sudo apt install unrar
If you are on CentOS / RHEL, you can use the yum command to install unrar:
# yum install unrar
For Fedora Linux users, utilize the dnf command:
$ sudo dnf install unrar
For FreeBSD Unix users, utilize the command pkg_add:
# pkg_add -v unrar
If you're on macOS Linux and Homebrew, employ the command brew:
$ brew install unrar
If the aforementioned commands don't work on your Linux/Unix version, download the binary package from the official rarlab website:
$ cd /tmp
## 32 bit linux ##
$ wget https://www.rarlab.com/rar/rarlinux-5.5.0.tar.gz
Alternatively, for Linux 64 bit version:
$ wget http://www.rarlab.com/rar/rarlinux-x64-5.3.b4.tar.gz
Next, extract the tar file you just downloaded using the Tar command:
$ tar -zxvf rarlinux-*.tar.gz
Both the unrar and rar commands are located in the rar subdirectory. Simply use cd to navigate to the rar directory:
$ cd rar
$ ./unrar
Then copy the rar and unrar files to the /usr/local/bin directory by entering the following command:
$ sudo cp rar unrar /usr/local/bin
Using the Unrar Command
The unrar command supports various options, here are some common options you need to extract files.
Extract RAR File
To extract rar on Linux or Unix in the current directory, use the command:
$ unrar e file.rar
Output Result:
List all files in the RAR file
Use the following command to list all files in the RAR file:
$ unrar l file.rar
Extract files with full path
To extract files with full path, use the following command:
$ unrar x file.rar
Check the integrity of RAR file
To check the integrity of the RAR file, use the following command:
$ unrar t file.rar
Output Result:
Get help with unrar command
Use the following command:
$ man unar
Or:
$ unrar | more
Output Result:
unrar
UNRAR 5.50 freeware Copyright (c) 1993-2017 Alexander Roshal
Usage: unrar
<@listfiles...>
e Extract files without archived paths
l[t[a],b] List archive contents [technical[all], bare]
p Print file to stdout
t Test archive files
v[t[a],b] Verbosely list archive contents [technical[all],bare]
x Extract files with full path
@[+] Disable [enable] file lists
ad Append archive name to destination path
ag[format] Generate archive name using the current date
ai Ignore file attributes
ap
c- Disable comments show
cfg- Disable read configuration
cl Convert names to lower case
cu Convert names to upper case
dh Open shared files
ep Exclude paths from names
ep3 Expand paths to full including the drive letter
f Freshen files
id[c,d,p,q] Disable messages
ierr Send all messages to stderr
inul Disable all messages
kb Keep broken extracted files
n
n@ Read additional filter masks from stdin
n@ Read additional filter masks from list file
o[+|-] Set the overwrite mode
ol[a] Process symbolic links as the link [absolute paths]
or Rename files automatically
ow Save or restore file owner and group
p[password] Set password
p- Do not query password
r Recurse subdirectories
sc
sl
sm
ta
tb
tn
to
ts[m|c|a] Save or restore file time (modification, creation, access)
u Update files
v List all volumes
ver[n] File version control
vp Pause before each volume
x
x@ Read file names to exclude from stdin
x@ Exclude files listed in specified list file
y Assume Yes on all queries
Above is the method to extract RAR files on Linux. Additionally, you can explore how to extract tar files on Linux, another commonly used compression format on this operating system. Opting for RAR or ZIP format is the best solution for file storage.
Furthermore, readers can search and refer to other articles on Mytour for additional information on extracting files using WinRAR on computers. You can download WinRAR for Linux here: RAR for Linux
Wishing you all success!