RAR archives remain common for downloads, backups, and vendor-distributed bundles, so extracting them cleanly on Linux matters when files need to be inspected, staged, or restored without switching to another platform. A predictable extraction flow also reduces the chance of unpacking into the wrong directory or overwriting existing files during shell work and remote sessions.

The unrar command reads archive metadata, lists stored entries, tests archive integrity, and writes the decompressed files into a chosen destination. Using the x action preserves archived path names, which is usually the safest behavior for project folders, software bundles, and split downloads that expect a specific directory layout.

Current Linux distributions do not package RAR readers identically, so package names and fallback commands vary even when the extraction workflow is the same. The steps below assume a working unrar command is already available in the shell and keep extraction in a dedicated target directory so overwrite prompts, password requests, and untrusted archive contents stay easier to control.

Steps to extract RAR files in Linux:

  1. Change to the directory that contains the .rar file and confirm the archive format before extracting it.
    $ cd /tmp/rar-demo
    $ file testfile.rar5.rar
    testfile.rar5.rar: RAR archive data, v5

    When the archive is split across volumes, run the listing, test, and extraction commands against the first volume such as project.part1.rar or project.part01.rar.

  2. List the archive contents without writing any files to disk.
    $ unrar l testfile.rar5.rar
    
    UNRAR 7.00 freeware      Copyright (c) 1993-2024 Alexander Roshal
    
    Archive: testfile.rar5.rar
    Details: RAR 5
    
     Attributes      Size     Date    Time   Name
    ----------- ---------  ---------- -----  ----
     -rw-rw-rw-        12  2001-01-01 05:00  testfile.txt
    ----------- ---------  ---------- -----  ----
                       12                    1

    The l action is the fastest way to confirm file names, sizes, and the directory layout stored inside the archive before anything is unpacked.

  3. Test the archive to confirm it can be read cleanly before extraction.
    $ unrar t testfile.rar5.rar
    
    UNRAR 7.00 freeware      Copyright (c) 1993-2024 Alexander Roshal
    
    
    Testing archive testfile.rar5.rar
    
    Testing     testfile.txt                                              OK
    All OK

    Encrypted archives prompt for a password during t or x when unrar needs to read the protected file data.

  4. Create a dedicated target directory for the extracted files.
    $ mkdir -p extracted

    Extracting into a clean directory makes it easier to review the restored files and avoids mixing them with unrelated data already present in the current path.

  5. Extract the archive into the target directory while preserving any archived paths.
    $ unrar x testfile.rar5.rar extracted/
    
    UNRAR 7.00 freeware      Copyright (c) 1993-2024 Alexander Roshal
    
    
    Extracting from testfile.rar5.rar
    
    Extracting  extracted/testfile.txt                                    OK
    All OK

    The x action keeps archived directory paths. Use e only when the directory structure inside the archive should be discarded. Add -o- to refuse overwriting existing files without prompting.

  6. Verify that the expected files were written to the destination directory.
    $ find extracted -maxdepth 2 -print | sort
    extracted
    extracted/testfile.txt

    A clean directory listing after All OK confirms that the files were restored into the intended target path.