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 Ubuntu, but it is available to install from its repository.
The following tutorial will show you how to install UNRAR on Ubuntu 22.04 LTS Jammy Jellyfish on a desktop or server, along with the most commonly used commands with the command line terminal.
Table of Contents
Update Ubuntu
Begin by running a quick update on your system to ensure it is up-to-date.
sudo apt update && sudo apt upgrade -y
Install UNRAR
The UNRAR package is by default on the Ubuntu 22.04 Jammy Jellyfish repository, making the installation straightforward. In your terminal, run the following command.
sudo apt install unrar-free -y
Lastly, verify the version installed to make sure the installation was successful.
unrar --version
Example output:
How to Use UNRAR on Ubuntu
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 --help
Example output:
Extract a RAR Archive Current Directory
Extract a RAR file in a current directory with the unrar -x command.
unrar -x {file-name}.rar
Alternative:
unrar --extract {file-name}.rar
Extract a RAR Archive to a Folder
Extract a RAR file that needs a specific path or destination directory using the following unrar -x command again, followed by the entire course of the final destination.
unrar -x {file-name}.rar /media/photos/
Alternative:
unrar --extract {file-name}.rar /media/photos/
Extract Only New Files from a RAR Archive
Extract a RAR archive and only pull the new files; use the following command.
unrar --extract-newer {filename}.rar
Extract RAR Archive with No Path Creations
Extract a RAR archive and not create all the subdirectories paths and keep all the files centralized in one directory; use the following unrar –extract-no-paths command.
unrar --extract-no-paths {filename}.rar
Extract a RAR Archive and Overwrite Existing Files
Extract a RAR archive and overwrite any existing files with the same filenames, use the following unrar -f command.
unrar -f {filename}.rar
Alternative:
unrar --force {filename}.rar
Extract a Password Protected RAR Archive
Extract a password-protected RAR archive with the following unrar -p command.
unrar -p {filename}.rar
Alternative:
unrar --password {filename}.rar
List a RAR File
List the files in a RAR file, use the following unrar -t command.
unrar -t {filename}.rar
Alternative:
unrar --list {filename}.rar
Comments and Conclusion
In the tutorial, you have learned how to install UNRAR on Ubuntu 22.04 LTS Jammy Jellyfish and how to use the most common commands.
UNRAR is an excellent option for the constant use of extensive archives that need compressing, especially if working between multiple operating systems such as Windows or macOS.