[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-freeis 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/
-
xpreserves the directory structure. -
Use
eif 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 byunrar-free— use the fullunrarpackage as shown above.
Let me know if you want to script this or automate it for multiple files.

浙公网安备 33010602011771号