Archives in Linux

Create an archive

Example: add all .jpg files from a directory to an archive

tar czf archive.tar.gz *.jpg

tar.gz

Extract an archive

tar xvzf archive_name.tar.gz

tar.bz2

tar xvjf archive_name.tar.bz2

To extract an archive into a specific directory, use the option -C or the --directory option

tar -xf archive.tar -C /target/directory
tar -xf archive.tar.gz --directory /target/directory

rar

Install unrar,

apt-get install unrar

then

unrar archive_name.rar

zip

Install unzip,

apt-get install unzip

then

unzip archive_name.zip

If these methods did not help, you can try installing p7zip. On Unix you can install peazip. As a last resort, you can use online archivers, for example wobzip

ktorrent is usually distributed as a .tar.bz2 archive, and it is extracted with:

tar -xvjf

Article author: Andrei Olegovich