unrar

Unzip rar file command to extract files from rar compressed package

grammar

unrar [options][switch command] [filename...][path]
unrar <command> [-<switch 1> -<switch N>] archive [files...] [path...]

Install

Enter the following command in Linux to download the installation package

wget https://www.rarlab.com/rar/rarlinux-6.0.2.tar.gz

cd ~/Downloads/
tar -zxvf rarlinux-6.0.2.tar.gz

Options

e #Extract the compressed file to the current directory
l[t,b] # List compressed files [technical information, concise]
p # Print the file to standard output.
t # Test compressed file
v[t,b] # List compressed files in detail [technical information, concise]
x # Decompress the file using absolute path

SWITCHES switch settings

Note: Each switch must be separated by a space. You can't put them together.

-av- # Disable, authenticity verification check.
-c- # Disable, comment display
-f # refresh files
-kb # Keep broken extracted files
-ierr # Send all messages to stderr.
-inul # Disable, all messages.
-o+ # Overwrite existing files.
-o- # Do not overwrite existing files
-p<password>
      	    # set password.
-p- # Do not query the password
-r # Recursive subdirectory.
-u # Update files.
-v # List all volumes.
-x<file>
      # Exclude specified files.
-x@<list>
      # Exclude files from the specified list of files.
-x@ # Read filenames to exclude from stdin.
-y # Assume yes for all queries.

Parameters

Directory: Specify the directory to display the list, or it can be a specific file.

Example

Unzip the compressed file text.rar in the current directory and extract the full path.

unrar x test.rar

Unzip the compressed file text.rar in the current directory and decompress the full path:

[root@linux ~]# unrar x test.rar

View the contents of the rar package:

[root@linux ~]# unrar l test.rar

Test whether the rar package can be decompressed successfully:

[root@linux ~]# unrar t test.rar

Unzip to the current folder:

[root@linux ~]# unrar e test.rar