There is also a package available called
rar
, that allows you to create .rar archives.
So you can use
rar
for creating/compressing the archives and
unrar
to extract/decompress them.
Personally for extracting archives - I use a Python program called dtrx (
Do
The
Right e
Xtract), which can decompress/extract any type of compressed format. As long as you have the appropriate decompression tools installed (e.g. unrar for rars, gunzip for zips, tar for .tar files etc).
It can deal with lots of other types of files: .cab, .7z, .xz, .tar.bz2, .tar.xz, .lzh, .gem etc etc.
dtrx is really handy if you deal with lots of different archive formats, and saves you from having to remember exactly what command-line switches you need in order to get a particular type of archive extracted.
So instead of having to remember a bunch of esoteric command line switches for each decompression tool, you can just use:
Where
/path/to/
is the path to the file and
file.type
is the filename and extension (e.g.
file.zip
, or
file.rar
.
And
dtrx
will determine which tool to use and will pass the appropriate parameters.
So for a single .tar.gz file:
And
dtrx
will automagically invoke
tar
(which in turn will invoke gunzip) to decompress and unarchive/extract the archive.
And if you have multiple archives in different formats in the current directory - and you want to extract them all, you could even do something like this:
Bash:
dtrx ./*.{rar,tar.gz,7z,zip}
And
dtrx
will attempt to extract ALL .rar, .tar.gz, .7z and .zip files that are in the current directory, using the appropriate tool for each file.
So
dtrx
saves you from having to worry about remembering a bunch of different command-line options for lots of different decompression/de-archiving tools. But in order for it to work, you must already have the appropriate tools installed for the types of files you want to extract.
Edit:
I forgot to mention this:
dtrx is in the package repositories of most
Linux distros. If it is not available in your distribution’s repositories, it can be installed as a local site package using pip for Python.
E.g.