linuxdot.org
 
 
 

Contents | Previous | Next

Tarballs, gzips, bzip2s, RPMs, and zips

$ tar

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.

switchdescription
ccreate
xextract
vverbose (to display what's going on)
ffilename follows (required)
zrun 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 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.


$ gzip

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


$ bzip2

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


# rpm

The Red Hat Package Manager, used by Red Hat Linux, Linux-Mandrake, SuSE Linux, and many other Linux distributions, is a utility that allows you to install, and uninstall RPM files (*.rpm). An RPM is usually named as follows:

packagename-version-release.architecture.rpm

For example:

xchat-1.8.5-0.i386.rpm

...where the package name is xchat, the version is 1.8.5, the release is 0, and the architecture is i386.

Note:

To determine your architecture, enter arch. An Athlon for example is i686 architecture, making it fine to install *.i686.rpm, *.i585.rpm, and *.i386.rpm RPMs.


rpm -Uvh xchat-1.8.5-0.i386.rpm
Upgrades xchat or installs the package if no previous version was found. U for upgrade, v for verbose (so you know what's going on), and h for hash (to show a progress bar).


rpm -e xchat
Uninstall (erase) the package xchat. When uninstalling, you only give the package name part, e.g. xchat, not the full package name, e.g. xchat-1.8.5-0.i386.rpm.


rpm -q xchat
Displays version of X-Chat RPM you have installed. Useful for discovering if you have something installed.


$ zip

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

unzip myzip
Unzip the file myzip.zip.

Contents | Previous | Next

 
Copyright © 1998-2002 Linuxdot.org.
Linux ® is a registered trademark of Linus Torvalds.