NoCache

Table of Contents

How to Extract and Create RAR Files with WinRAR on Arch Linux/Manjaro

Cyrus Kao
Last modified on .

RAR is a very common format for archiving on Windows. Since Linux systems usually prefer tarball, generally only tar will be installed with your distro by default. On Arch-based Linux distros, there are two packages that can be used, unrar for extracting and rar for both extracting and creating RAR archives.

Installation

Install the package depending on your needs.

Both Extracting and Creating

For both extracting and creating RAR files, install rar from AUR.

  • Install with pacman:

    $ sudo pacman -S --needed git && git clone https://aur.archlinux.org/rar.git && cd rar && makepkg -si
    
  • Install with yay:

    $ yay -S rar
    

Extracting Only

For extracting RAR files only, install unrar from AUR.

  • Install with pacman:

    $ sudo pacman -S unrar
    
  • Install with yay:

    $ yay -S unrar
    

Usage

Creating/Updating Archives

For example, we're creating a RAR archive named archive.rar containing the Downloads folder:

$ rar a archive.rar Downloads
Creating archive archive.rar

Adding    Downloads/backup-1644905322287.tar.gz            OK
Adding    Downloads/backup-1644816784522.tar.gz            OK
Adding    Downloads/backup-1644737437055.tar.gz            OK
Adding    Downloads/backup-1644990332537.tar.gz            OK
Adding    Downloads/backup-1644906390827.tar.gz            OK
Adding    Downloads/backup-1644754107014.tar.gz            OK
Adding    Downloads                                        OK
Done
Output

If the target RAR archive already exists, then the command will update its content instead:

$ rar a archive.rar Downloads
Updating archive archive.rar

Updating  Downloads/backup-1644905322287.tar.gz            OK
Updating  Downloads/backup-1644816784522.tar.gz            OK
Updating  Downloads/backup-1644737437055.tar.gz            OK
Updating  Downloads/backup-1644990332537.tar.gz            OK
Updating  Downloads/backup-1644906390827.tar.gz            OK
Updating  Downloads/backup-1644754107014.tar.gz            OK
Updating  Downloads                                        OK
Adding    Downloads/backup-1644992010699.tar.gz            OK
Done
Output

And here is the created archive:

archive.rar
archive.rar in GNOME Archive Manager

Extracting Archives

Without Archived Paths

Extract archive.rar without its original directory structure:

$ unrar e archive.rar
Extracting from archive.rar

Extracting  backup-1644905322287.tar.gz                               OK
Extracting  backup-1644816784522.tar.gz                               OK
Extracting  backup-1644737437055.tar.gz                               OK
Extracting  backup-1644990332537.tar.gz                               OK
Extracting  backup-1644906390827.tar.gz                               OK
Extracting  backup-1644992010699.tar.gz                               OK
Extracting  backup-1644754107014.tar.gz                               OK
All OK
Output

Extracted files:

File structure
File structure in GNOME Files

With Full Path

Extract with its original directory structure:

$ unrar x archive.rar
Extracting from archive.rar

Would you like to replace the existing file Downloads/backup-1644905322287.tar.gz
3130594 bytes, modified on 2022-02-15 14:08
with a new one
3130594 bytes, modified on 2022-02-15 14:08

[Y]es, [N]o, [A]ll, n[E]ver, [R]ename, [Q]uit a

Extracting  Downloads/backup-1644905322287.tar.gz                     OK
Extracting  Downloads/backup-1644816784522.tar.gz                     OK
Extracting  Downloads/backup-1644737437055.tar.gz                     OK
Extracting  Downloads/backup-1644990332537.tar.gz                     OK
Extracting  Downloads/backup-1644906390827.tar.gz                     OK
Extracting  Downloads/backup-1644992010699.tar.gz                     OK
Extracting  Downloads/backup-1644754107014.tar.gz                     OK
All OK
Output

Folder Downloads Extracted then replaced the existing files in the current Downloads directory:

File structure
File structure in GNOME Files

See Also

Comments

Sign in to leave a comment.