![]() |
![]() |
| Linux news | Newbie's Linux manual | Linux links | Link us | ||
| The Linux columns | Book reviews | ||
| DistroWatch + TuxReports | August 11, 2002 | |
Contents | Previous | Next | Download
A file with the extension .tar is a tarball. A file with the extension .tar.gz (and less commonly .tgz) is a compressed tarball.
A tarball is one or more files bunched together to form a single file (an archive) with the tar utility. This uncompressed .tar file can then be compressed with gzip to form a .tar.gz (or .tgz) file.
Using tar is simple. Just remember: c to create or x to extract; and tag on vfz.
| switch | description |
| c | create |
| x | extract |
| v | verbose (to display what's going on) |
| f | filename follows (required) |
| z | run through gzip to compress/uncompress |
tar xvfz foo.tar.gz
Extract the contents of the foo.tar.gz file.
tar cvfz foo.tar.gz foo
Create a compressed (gzipped) tarball called foo.tar.gz, containing the directory foo.
tar cvfj foo.tar.bz2 foo
Create a compressed tarball using the superior (20% better compression), but slower bzip2 compression, rather than the more prevalent gzip compression.
tar xvfj foo.tar.bz2
Extract the contents of the foo.tar.bz2 file.
The gzip command compresses a single file. (Unlike tar cvfz that creates a separate archive and then compresses that archive.)
gzip report.pdf
Compress report.pdf as report.pdf.gz.
gzip -d report.pdf.gz
Decompress report.pdf.gz, so it becomes, report.pdf.
Note:
Alternatively to do the same thing, you can use: gunzip report.pdf.gz
The bzip2 command compresses a single file. (Unlike tar cvfj that creates a separate archive and then compresses that archive.)
bzip2 report.pdf
Compress report.pdf as report.pdf.bz2.
bzip2 -d report.pdf.bz2
Decompress report.pdf.bz2, so it becomes, report.pdf.
Note:
Alternatively to do the same thing, you can use: bunzip2 report.pdf.bz2
Zips (.zip) are a popular archiving and compression format used in Microsoft Windows.
zip reportbk report
Zip the file report as reportbk.zip.
zip -r myzip mydir
Zip the directory mydir as myzip.zip. -r (recursive) being required to zip directories.
unzip myzip
Unzip the file myzip.zip.
Contents | Previous | Next | Download
| About us | |
| Latest stable kernel: 2.4.19 | Latest development kernel: 2.5.31 Copyright © 1998-2002 Linuxdot.org. Linux ® is a registered trademark of Linus Torvalds. |
|