Previous Next Contents

8. The Remaining 1%

8.1 Using tar & gzip

Under UNIX there are some widely used applications to archive and compress files. tar is used to make archives---it's like PKZIP but it doesn't compress, it only archives. To make a new archive:

$ tar -cvf <archive_name.tar> <file> [file...]

To extract files from an archive:

$ tar -xpvf <archive_name.tar> [file...]

To list the contents of an archive:

$ tar -tf <archive_name.tar> | less

You can compress files using compress, which is obsolete and shouldn't be used any more, or gzip:

$ compress <file>
$ gzip <file>

that creates a compressed file with extension .Z (compress) or .gz (gzip). These programs can compress only one file at a time. To decompress, use:

$ compress -d <file.Z>
$ gzip -d <file.gz>


The unarj, zip and unzip (PK??ZIP compatible) utilities are also available. Files with extension .tar.gz or .tgz (archived with tar, then compressed with gzip) are as common in the UNIX world as .ZIP files are under DOS. Here's how to list the contents of a .tar.gz archive:

$ gzip -dc <file.tar.gz> | tar tf - | less

or, equivalently,

$ tar -ztf <file.tar.gz> | less

8.2 Installing Applications

First of all: installing packages is root's work. Some Linux applications are distributed as .tar.gz or .tgz archives, specifically prepared so that they can be decompressed from / typing the following command:

# gzip -dc <file.tar.gz> | tar xvf -

or, equivalently,

$ tar -zxf <file.tar.gz>

The files will be decompressed in the right directory, which will be created on the fly. Users of the Slackware distribution have a user-friendly pkgtool program; another is rpm, which is available on all distributions thanks to Red Hat.

Most programs shouldn't be installed from /; typically, the archive will contain a directory called pkgname/ and a lot of files and/or subdirectories under pkgname/. A good rule is to install those packages from /usr/local. Besides, some programs are distributed as C or C++ source files, which you'll have to compile to create the binaries. In most cases, all you have to do is issue make. Obviously, you'll need the gcc or g++ compiler.

8.3 Tips You Can't Do Without

Command completion: pressing <TAB> when issuing a command will complete the command line for you. Example: you have to type gcc this_is_a_long_name.c; typing gcc thi<TAB> will suffice. (If you have other files that start with the same characters, supply enough characters to resolve any ambiguity.)

Backscrolling: pressing SHIFT + PAG UP (the grey key) allows you to backscroll a few pages, depending on how much video memory you have.

Resetting the screen: if you happen to more or cat a binary file, your screen may end up full of garbage. To fix things, blind type reset or this sequence of characters: echo CTRL-V ESC c RETURN.

Pasting text: in console, see below; in X, click and drag to select the text in an xterm window, then click the middle button (or the two buttons together if you have a two-button mouse) to paste. There is also xclipboard (alas, only for text); don't get confused by its very slow response.

Using the mouse: install gpm, a mouse driver for the console. Click and drag to select text, then right click to paste the selected text. It works across different VCs.

Messages from the kernel: have a look at /var/adm/messages or /var/log/messages as root to see what the kernel has to tell you, including bootup messages. The command dmesg is also handy.

8.4 Useful Programs and Commands

This list reflects my personal preferences and needs, of course. First of all, where to find them. Since you all know how to surf the Net and how to use archie and ftp, I'll just give you three of the most important addresses for Linux:,, and Please use your nearest mirror.

8.5 Common Extensions and Related Programs

You may come across scores of file extensions. Excluding the more exotic ones (i.e. fonts, etc.), here's a list of who's what:

Previous Next Contents