‘.tar’, ‘.gz’, ‘.tar.gz’, ‘.bz2′, ‘tar.bz2′, ‘.zip’. What are these strange extensions? Mostly you ll think these are all compressed files. But its better to understand exactly what these are. And why do we need them.
According to above extensions some are for compressed and some tells that they are archived.
In linux/unix environment there are 2 main compression algorithms. They are ‘gzip’ and ‘bzip’. The difference of ‘bzip’ from ‘gzip’ is that ‘bzip’ is more capable of making smaller files than ‘gzip’. But ‘bzip’ consumes much more memory and takes time.
as usual open up your favorite terminal/konsole . Then follow the commands. I m having 4 files inside /home/dushi/test directory.
now im gona compress file1.txt using bzip2.
Thats all. Now ‘file1.txt’ is replaced by ‘file1.txt.bz2′
Lets decompress that newly compressed file back to ‘file1.txt’.
it will decompress the ‘.bz2′ file into its originals.
same as above its really simple. I’m gona compress ‘file2.txt’ using ‘gzip’. it gives ‘file2.txt.gz’.
use -d to decompress.
The ‘.tar’ format is the most common archive format in linux/unix environment. They are mostly called as tarballs. Archives are not compressed files. It combines one or more files into a single file. The idea is to achieve easier storage and transportation. Specially in web.
lets go back into my /home/dushi/test/ directory again.
There are 4 files. Two compressed files and two normal text files. Lets archive them all into ‘MyArchive.tar’ .
from about cmd makes a tarball as ‘MyArchive.tar’ . To extract files from it ,
Thats all u should know :) for more options refer,