Next Previous Contents

9. The Remaining 1%

More than 1%, actually...

9.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>

RMP.

There are also the unarj, zip and unzip (PK??ZIP compatible) utilities. 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:

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

9.2 Installing Applications

First of all: installing packages is root's work. Most Linux applications are distributed as a .tar.gz archive, which typically will contain a directory called pkgname/ containing files and/or subdirectories. A good rule is to install these packages from /usr/local with the command

# tar -zxf <archive.tar.gz>

reading then the README or INSTALL file. In many cases, the package is distributed in source, which you'll have to compile to create the binaries; often, typing make then make installwill suffice. Obviously, you'll need the gcc or g++ compiler.

Other archives may have to be unpacked from /; this is the case with Slackware's .tgz archives. Other archives contain the files but not a subdirectory. Always list the contents of the archive before installing it.

The Debian and Red Hat distributions have their own archive format; respectively, .deb and .rpm. The latter is gaining wide acceptance; to install an .rpm package, type

# rpm -i package.rpm

9.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 it, 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: if you installed gpm, a mouse driver for the console, you can 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.

9.4 Where to Find Applications

If you're wondering whether there are applications to replace your old DOS/Win ones, I suggest that you browse the main Linux software repositories: ftp://sunsite.unc.edu/pub/Linux , ftp://tsx-11.mit.edu/pub/linux , and ftp://ftp.funet.fi/pub/Linux . Another excellent place is the ``Linux Applications and Utilities Page'' at http://www.xnet.com/~blatura/linapps.shtml .

9.5 A Few Things You Couldn't Do

Linux can do an awful lot of things that were cumbersome, difficult or impossible do to with DOS/Win. Here's a short list that may whet your appetite:

9.6 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:

9.7 Converting Files

If you need to exchange text files between DOS/Win and Linux, beware of the ``end of line'' problem. Under DOS, each line of text ends with CR/LF, while under Linux with LF. If you try to edit a DOS text file under Linux, each line will likely end with a strange--looking `M' character; a Linux text file under DOS will appear as a kilometric single line with no paragraphs. There are a couple of tools, dos2unix and unix2dos, to convert the files.

If your files contain accented characters, make sure they are made under Windows (with Write or Notepad, say) and not under plain DOS; otherwise, all accented characters will be screwed up.

To convert Word or WordPerfect files to plain text, the matter is a bit trickier but possible. You'll need one of the tools that can be found on the CTAN sites; one is ftp://ftp.tex.ac.uk . Get the package word2x from the directory /pub/tex/tools/', or try one the packages available in directory /pub/tex/support/. I've only tried word2x, and works quite well.


Next Previous Contents