Quick Tip #3: How to Extract Common Archives under Linux

Print this articlePrint this article

All files that are compressed with tar utility can be decompressed with it easily. But what about files compressed with WinZip, RAR or ARJ programs?
Luckily for you, there are corresponding utilities and in this short tip, we’ll try cover it thoroughly.

How to extract files from Zip archive
To extract files from *.zip archive, use ‘unzip‘ utility:

unzip filename.zip – will extract all files from filename.zip to current directory

To extract file from *.zip archive to specific folder, issue the following command:

unzip filename.zip -d /somepath – will extract all files from filename.zip to /somepath

To extract single file from *.zip archive, use the following command:

unzip filename.zip README.txt – will extract README.txt only from filename.zip to current directory

How to extract files from Rar archive
To extract files from *.rar archive, use ‘unrar’ utility:

unrar e filename.rar – will extract all files from filename.rar to current directory

NOTE: This will extract all files as-is without recreating paths.

To extract files from *.rar archive recreating paths, execute the following command:

unrar x filename.rar – will extract all files from filename.rar, recreating original paths

To extract file from *.rar archive to specific folder, issue the following command:

unrar e filename.rar /somepath – will extract all files from filename.rar to /somepath

To extract single file from *.rar archive, use the following command:

unrar e filename.rar File.txt – will extract File.txt only from filename.rar to current directory

How to extract files from Arj archive
To extract files from *.arj archive, use ‘unarj’ utility:

unarj e filename.arj – will extract all files from filename.arj to current directory

To extract files from *.arj archive recreating paths, execute the following command:

unarj x filename.arj – will extract all files from filename.arj, recreating original paths

To extract file from *.arj archive to specific folder, issue the following command:

unarj e filename.arj -ht /somepath – will extract all files from filename.arj to /somepath

To extract single file from *.arj archive, use the following command:

unarj e filename.arj INFO.txt – will extract INFO.txt only from filename.arj to current directory

NOTE: All these utilities support traditional zip, rar and arj archives, and therefore might not decompress newer formats, such as ones defined by WinZip, WinRar and WinARJ applications. If you fail to extract files from these archives, please see tip #4 – How to Unpack ANY Archive under Linux.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <span>
  • Lines and paragraphs break automatically.
  • Each email address will be obfuscated in a human readable fashion or (if JavaScript is enabled) replaced with a spamproof clickable link.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Each email address will be obfuscated in a human readable fashion or (if JavaScript is enabled) replaced with a spamproof clickable link.
Image CAPTCHA
Enter the characters shown in the image.