What hasn't yet been mentioned is the swiss-army-knife of command-line utilities:
atool; it is available in the repositories: click atool or run
sudo apt-get install atool.
atool is actually a script comprising various functions such as aunpack, apack, als, acat, adiff, and arepack. Probably the most common use of the program is to extract archives using the aunpack command. There are quite a few interesting and useful options, but the basic way to extract most archives is just to run, for example,
The support for tar, 7z, zip, jar, rar, ar, lha and many more archive formats and their variations are documented by entering
man atool in the terminal or by viewing the Ubuntu manpage online.
So, the useful thing is that if you have a tar, zip and gz archive in the same folder, all you need to do to extract them all is to run
aunpack -e *
and all supported archives will be unpacked with their folder structure retained. If the name of the resulting folder already exists, it will not be overwritten, but will be given a unique name like unpack-5645.
Or if you want to choose just one type of archive and unpack them all, instead use
aunpack -e *.zip
If you need files unpacked directly in a particular directory, with only the sub folder directory structure being retained (if it exits), enter, for example,
aunpack -e Scripts11.zip -X /home/mike/Videos
If a file with the same name already exists, you will be prompted for an action either to rename or overwrite unless you have specified the force option (
-f) in the command.
As the manpage notes, aunpack first extracts
files to a unique
(temporary) directory, and then mov[es] its contents back if possible.
This also prevents local files from being overwritten by mistake.
With the other tools, other actions are possible, as mentioned by the man page:
- apack creates archives from the files or folder specifies or stdin
- als lists files within the specifies archive
- acat enables one to extract archive files to stdout
- adiff enables you to compare the two archives specified
- arepack makes it possible to convert one archive format to another by placing the contents of the original archive in a temporary folder and then repacking the new one.
There are many more useful options for all of the utilities, but probably the one used the most will be aunpack, as that makes it so easy to extract multiple, different archives. It is great to be able to just issue one command and be able to extract multiple different archive formats without having to use the various commands for tar, zip, etc.
For a very recent article describing how to integrate the atool functions into the custom actions of your filemanager, such as Thunar, see this online magazine.