Install UNRAR on Linux Mint 20 LTS

UNRAR is widely known and used amongst Windows users. RAR files are much smaller archives and compress better than ZIP for most files by compressing files “together,” saving more space. UNRAR does not come pre-installed natively on Linux Mint, but it is available to install from its repository.

The following tutorial will show you how to install UNRAR on Linux Mint 20 LTS, along with the most commonly used commands.

Update Linux Mint System

Update your Linux Mint operating system to make sure all existing packages are up to date:

sudo apt update && sudo apt upgrade -y

Install UNRAR

The first step is to install the UNRAR application. For this, you do not need to add any additional third-party repositories as it is present in Linux Mint’s default repository.

In your terminal, use the following command.

sudo apt install unrar-free

Example output:

Install UNRAR on Linux Mint 20 LTS

Type Y, then press the ENTER KEY to proceed.

Lastly, verify the version installed to make sure the installation was successful.

unrar --version

Example output:

unrar 0.0.1

Type Y, then press the ENTER KEY to proceed.

Lastly, verify the version installed to make sure the installation was successful.

unrar -version | grep UNRAR

Example output:

UNRAR 5.61 beta 1 freeware      Copyright (c) 1993-2018 Alexander Roshal

Using UNRAR Terminal Commands

Below are some basic commands and examples of using UNRAR. While they do not show everything possible, they cover 75% of what most users would use UNRAR for regularly.

The first command that is most helpful before the tutorial continues further is the help command.

unrar

Example output:

Usage:     unrar <command> -<switch 1> -<switch N> <archive> <files...>
               <@listfiles...> <path_to_extract\>

<Commands>
  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

<Switches>
  -             Stop switches scanning
  @[+]          Disable [enable] file lists
  ad[1,2]       Alternate destination path
  ag[format]    Generate archive name using the current date
  ai            Ignore file attributes
  ap<path>      Set path inside archive
  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
  ep4<path>     Exclude the path prefix from names
  f             Freshen files
  id[c,d,n,p,q] Display or disable messages
  ierr          Send all messages to stderr
  inul          Disable all messages
  kb            Keep broken extracted files
  me[par]       Set encryption parameters
  n<file>       Additionally filter included files
  n@            Read additional filter masks from stdin
  n@<list>      Read additional filter masks from list file
  o[+|-]        Set the overwrite mode
  ol[a]         Process symbolic links as the link [absolute paths]
  op<path>      Set the output path for extracted files
  or            Rename files automatically
  ow            Save or restore file owner and group
  p[password]   Set password
  r             Recurse subdirectories
  sc<chr>[obj]  Specify the character set
  si[name]      Read data from standard input (stdin)
  sl<size>      Process files with size less than specified
  sm<size>      Process files with size more than specified
  ta[mcao]<d>   Process files modified after <d> YYYYMMDDHHMMSS date
  tb[mcao]<d>   Process files modified before <d> YYYYMMDDHHMMSS date
  tn[mcao]<t>   Process files newer than <t> time
  to[mcao]<t>   Process files older than <t> time
  ts[m,c,a,p]   Save or restore time (modification, creation, access, preserve)
  u             Update files
  v             List all volumes
  ver[n]        File version control
  vp            Pause before each volume
  x<file>       Exclude specified file
  x@            Read file names to exclude from stdin
  x@<list>      Exclude files listed in specified list file
  y             Assume Yes on all queries

Extract a RAR Archive Current Directory

To extract or open a RAR file in a current directory, use the unrar e command.

unrar e {file-name}.rar

Extract a RAR Archive to Folder

To extract or open a RAR file that needs a specific path or destination directory, use the following unrar e command again, followed by the full path of the final destination.

unrar e {file-name}.rar /target/path

Example:

unrar {filename}.rar /opt/

Extract a RAR Archive with Directory Structure

To extract a RAR archive with their directory structure, use the unrar x command.

unrar x {filename}.rar

List a RAR File

To list the files in a RAR file, use the following unrar l command. Additionally, list archive contents [technical[all], bare].

unrar l[technical[all], bare] {filename}.rar

Example:

unrar l[t[a],b] {filename}.rar

Test a RAR File

To test the files in a RAR file, use the following unrar t command.

unrar t {filename}.rar

More information can be also be found by using the man command (manual pages).

man unrar

Example output:

Install UNRAR on Linux Mint 20 LTS

Comments and Conclusion

In the tutorial, you have learned how to install UNRAR on Linux Mint 20 LTS and use the most common commands.

Overall, UNRAR is an excellent option for constant use of extensive archives that need compressing, especially if working between multiple operating systems such as Windows or macOS.



Follow LinuxCapable.com!

Like to get automatic updates? Follow us on one of our social media accounts!