User Tools

Site Tools


Archives and file compression

Comparison between compression algorithms

Algorithm Comments
gzip + fast compression
- medium compression rate
bzip2 + slow compression
- high compression rate

Equivalent File Suffixes

Short Long
.tgz .tar.gz
.tbz, .tbz2 & .tb2 .tar.bz2
.taz .tar.Z
.tlz .tar.lz
.txz .tar.xz

tar archiving utility

Create a archive of a directory

using tar (no compression)

tar -cvf /home/www/

using gzip compression

tar -czvf alldocs.tgz *.doc

using bzip2 compression

tar -cvjf /home/www/

Extract the contents of a archive with tar

Extract a tar archiv

tar -xvf foo.tar

Extract a gzip archiv

tar -xvzf foo.gz

Extract a bz2 archive

tar -xjvf file.tar.bz2

Show a tar file's table of contents

tar -tzf foo.gz


Files compressed with bzip2 usually have the .bz2 extension. Note that bzip2 also will change file names after decompression:

archive name file name after decompression with bzip2
filename.bz2 filename filename
filename.tbz2 filename.tar
filename.tbz filename.tar
anyothername anyothername.out

Create a bzip2 archive from a file

bzip2 -f filename

Decropress a bzip2 archive

bunzip2 filename
/srv/ · Last modified: 2013/02/07 09:31 by niwo