To extract files from literally ANY existing archive, except really rare or closed sourced, there is a wonderful utility called 7-Zip. Unfortunately, it is only available for Microsoft Windows based systems.
Luckily, there is a command line port called ‘p7zip’, giving you all features of 7 Zip under Linux shell.
To begin working with it, we should first install it. Easiest way to do it, is by using package manager default to your system. In our case, it is APT which is default for Ubuntu.
So, we execute this command:
sudo apt-get install p7zip
NOTE: It WILL ask you for your (administrative) password, so be ready to type it in.
After it is installed, you can easily work with it, executing ‘7za’ command.
To extract files from *.7z, *.cab, *.rpm, *.deb, *.zip and many other archives, use single command:
7za e archive.[ARCHIVE extension]
For example:7za e “Full Wikileaks Archive.zip”7za e “wikileaks cablegate-201103061731.7z”7za e Data1.cab
To extract files to specific path, issue the following command:
7za e -o/somepath MySQL-5.1.rpm – will extract contents of MySQL-5.1.rpm to /somepath
To extract files recreating full paths, execute the following command:
7za x Apache-2.deb – will extract all files with full paths from Apache-2.deb
To extract a single file from 7-zip supported archive, issue this command:
7za e Games.zip descr.lst – will extract descr.lst from Games.zip
BUT, if archives are compressed using two programs or more, it will only see content of the topmost archive. For example, if we have archive named GeoIP.tar.gz with README archived inside, issuing the following command:
7za e GeoIP.tar.gz README – will NOT extract README file
Because it will see only topmost content, which, in our case is GeoIP-1.4.6.tar (sub-archive of gzipped GeoIP.tar.gzip). So, in order to extract a single file from such archive, we should first extract topmost file:
7za e GeoIP.tar.gz
This will leave us with GeoIP-1.4.6.tar, from which we can extract README file with:
7za e -r GeoIP-1.4.6.tar README
Add new comment