[Ubuntu]extract a .rar file on Ubuntu

 

 

To extract a .rar file on Ubuntu, you need to install a tool capable of handling the RAR format, since it's not supported natively. Here's the proper way to do it:


✅ Step-by-Step Instructions

1. Install unrar

sudo apt update
sudo apt install unrar

If you're dealing with RAR version 5 or newer, unrar (the non-free version from RARLab) is necessary. unrar-free is outdated and limited.


2. Extract the .rar File

Extract to current directory:

unrar x archive.rar

Extract to a specific directory:

unrar x archive.rar /path/to/output/
  • x preserves the directory structure.

  • Use e if you want to extract all files to a single directory, discarding folder hierarchy:

    unrar e archive.rar
    

3. List Contents Without Extracting

unrar l archive.rar

⚠️ Notes

  • If the archive is password-protected, you'll be prompted to enter it.

  • If you see an error like No files to extract, it's likely a newer RAR format not supported by unrar-free — use the full unrar package as shown above.


Let me know if you want to script this or automate it for multiple files.

 

posted @ 2025-05-13 08:43  profesor  阅读(28)  评论(0)    收藏  举报