Overview: Archive tools for linux
April 7th, 2007 mysurface Posted in 7z, Archive, bunzip2, bzip2, gunzip, gzip, rar, tar, unzip, zip | Hits: 33718 |
There are various archive file format exist, such as .tar.gz, .tgz, .tar.bz2, .gz, .bz2, .zip, .rar, .7z. The common questions regarding archives are “how to extract files from tar.gz?”, “how to create rar in Linux?” etc.
Therefore this overview aims to covers simple examples of archive tool usage for the common format such as:
tar, gzip, gunzip, bzip2, bunzip2, zip, unzip, rar, 7z.
tar.gz or tgz
tar.gz can be known as the most common archive for Linux users.
To create this archive,
tar czvf my_pro.tar.gz file1 file2
To extract file from this archive,
tar xzvf my_pro.tar.gz
Extract to specified directory,
tar xzvf my_pro.tar.gz -C ~/dump
For more information or more advance options, check out tar normal operation.
tar.bz2
This format is claim to be more compress than tar.gz, for certain large archives, people compress it into tar.bz2.
To create this archive,
tar cjvf my_pro.tar.bz2 file1 file2
To extract file from this archive,
tar xjvf my_pro.tar.bz2
For more information or more advanced options, check out tar normal operation.
gz
gz is different from tar.gz, you will fail to extract files if you use tar for gz archive. The compress ratio are low, this is an old ways of compress file, seldom see people doing that anymore. The different between tar.gz and gz besides compress ratio, is when you create a gz, your source file will be compressed into gz (source file will be missing), then same thing happen to decompress gz, after decompress, gz file is missing.
To create this archive,
gzip file1.php
To extract file from this archive,
gunzip file1.gz
bz2
bzip2 is always an alternatives to gz format, compress and decompress are similar to gz.
To create this archive,
bzip file1.php
To extract file from this archive,
bunzip2 file1.bz2
zip
zip is a common archive format for windows user. To make it compatible, people likes to use this format. Well you can create or extract zip file in Linux.
To create this archive,
zip wp.zip wordpress/*
To extract file from this archive,
unzip wp.zip
rar
rar is another alternative to zip format, compress ratio is higher than zip.
To create this archive,
rar a wp.rar wordpress/*
To extract file from this archive,
rar e wp.rar
7z
7z (Seven Zip) is a new archive tool that have high compress ratio, It do support for both windows and Linux platform.
To create this archive,
7z a doc.7z file1.pdf file2.pdf file3.pdf
To extract file from this archive,
7z e doc.7z
Awkward archives
Sometimes I do obtain certain zip file contain tar.gz and vice versa, therefore you need to decompress another time after you extract the tar.gz out from zip file. It is kind of rare, but it does exist.
Archives Official Website
Live Chat!









April 8th, 2007 at 1:59 am
[...] Læs mere her [...]
April 10th, 2007 at 11:25 pm
not “7z e doc.7z”
but “7z x doc.7z”
so that you get the directory structure too!
May 11th, 2007 at 7:45 pm
excellent reference - thanks!