RAR archives remain common for distributing software, backups, and multi-part downloads, so the ability to open them directly on Linux keeps workflows efficient and avoids switching tools or operating systems. Handling RAR files from the terminal also integrates well with scripts and remote administration over SSH.

The proprietary RAR format stores one or more files in a compressed container, and on Linux extraction is typically handled by the unrar utility. Once available, unrar can identify archive details, test integrity, and extract content with or without preserving the original directory structure.

Because unrar is not always installed by default and RAR archives can be large or untrusted, it is important to choose the correct package, check free disk space, and extract into a suitable directory. Archives from untrusted sources should be inspected carefully and, where appropriate, scanned with security tools before opening.

Steps to extract RAR files on Linux:

  1. Open a terminal on the Linux system.
  2. Confirm the file is a RAR archive using the file command.
    $ file archive.rar
    archive.rar: RAR archive data, v5
  3. Install the unrar utility from the package repository if it is not already present.
    $ sudo apt update && sudo apt install --assume-yes unrar  # Ubuntu and Debian
    [sudo] password for user: Hit:1 http://my.archive.ubuntu.com/ubuntu noble InRelease
    Hit:2 http://my.archive.ubuntu.com/ubuntu noble-updates InRelease
    Hit:3 http://my.archive.ubuntu.com/ubuntu noble-backports InRelease
    Hit:4 http://security.ubuntu.com/ubuntu noble-security InRelease
    Reading package lists...
    Reading package lists...
    Building dependency tree...
    Reading state information...
    unrar is already the newest version (1:7.0.7-1build1).
    0 upgraded, 0 newly installed, 0 to remove and 266 not upgraded.

    On CentOS 7 and similar Red Hat variants where unrar is not available, install unar as an alternative:

    $ sudo yum install --assumeyes epel-release && sudo yum install --assumeyes unar  # CentOS 7 and other Red Hat variants
    [sudo] password for user:

    On openSUSE and other SUSE variants, install unrar from the main repositories:

    $ sudo zypper refresh && sudo zypper --non-interactive install unrar  # openSUSE and other SUSE variants
    [sudo] password for root:
    Repository 'Main Repository (NON-OSS)' is up to date.
    Repository 'Main Repository (OSS)' is up to date.
    Repository 'Main Update Repository' is up to date.
    All repositories have been refreshed.
    Loading repository data...
    Reading installed packages...
    Resolving package dependencies...
    
    The following NEW package is going to be installed:
      unrar
    
    1 new package to install.
    Overall download size: 155.3 KiB. Already cached: 0 B. After the operation, additional 334.1 KiB will be used.
    Continue? [y/n/v/...? shows all options] (y): y
  4. Preview the contents of the RAR file before extraction.
    $ unrar l archive.rar
    
    UNRAR 7.00 freeware      Copyright (c) 1993-2024 Alexander Roshal
    
    Archive: archive.rar
    Details: RAR 5
    
     Attributes      Size     Date    Time   Name
    ----------- ---------  ---------- -----  ----
     -rw-r--r--        23  2026-01-11 06:18  folder-01/file-02
     -rw-r--r--        23  2026-01-11 06:18  folder-01/file-01
     -rw-r--r--        23  2026-01-11 06:18  folder-02/file-02
     -rw-r--r--        23  2026-01-11 06:18  folder-02/file-01
     drwxr-xr-x         0  2026-01-11 06:18  folder-01
     drwxr-xr-x         0  2026-01-11 06:18  folder-02
    ----------- ---------  ---------- -----  ----
                       92                    6

    The l command lists archive contents without extracting any files.

  5. Check that sufficient free disk space is available at the extraction target.
    $ df -h .
    Filesystem                         Size  Used Avail Use% Mounted on
    /dev/mapper/ubuntu--vg-ubuntu--lv   98G  6.2G   87G   7% /

    Extracting large RAR archives without enough free space can leave partially written files and corrupt the target directory.

  6. Create a directory to hold the extracted files if a separate location is desired.
    $ mkdir directory
  7. Change into the directory that will receive the extracted files.
    $ cd directory
  8. Extract the files from the RAR archive while preserving the directory structure.
    $ unrar x ../archive.rar
    
    UNRAR 7.00 freeware      Copyright (c) 1993-2024 Alexander Roshal
    
    
    Extracting from ../archive.rar
    
    Creating    folder-01                                                 OK
    Extracting  folder-01/file-02                                            OK 
    Extracting  folder-01/file-01                                            OK 
    Creating    folder-02                                                 OK
    Extracting  folder-02/file-02                                            OK 
    Extracting  folder-02/file-01                                            OK 
    All OK

    The x command extracts each entry with its full path as stored in the archive. Other useful unrar commands are available from the built-in help:

    $ unrar
    
    UNRAR 7.00 freeware      Copyright (c) 1993-2024 Alexander Roshal
    
    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
  9. Verify the extracted files and directory layout recursively.
    $ ls -R
    .:
    folder-01
    folder-02
    
    ./folder-01:
    file-01
    file-02
    
    ./folder-02:
    file-01
    file-02