CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >

10. Useful Programs

10.1. Browsing Files: less

You'll use this file browser every day, so I'll give you a couple of tips to use it at best. First of all, ask your sysadm to configure less so as it can display not only plain text files, but also compressed files, archives, and so on.

Like recent versions of TYPE, less lets you browse files in both directions. It also accepts several commands that are issued pressing a key. The most useful are:

10.2. Numbered Backups Under Linux

Alas, Linux doesn't still support file version numbers, but you overcome this limitation in two ways. The first is to use RCS, the Revision Control System, which allows you to keep previous versions of a file. RCS is covered in ``The RCS MINI-HOWTO'' ().

The second way is to use an editor that knows how to deal with numbered backups; emacs and jed are OK. In emacs, add these lines in your .emacs:

(setq version-control t)
(setq kept-new-versions 15) ;;; or any other value
(setq kept-old-versions 15)
(setq backup-by-copying-when-linked t)
(setq backup-by-copying-when-mismatch t)

In jed, make sure you have version 0.98.7 or newer; the patch for numbered backups is available on .

10.3. Archiving: tar & gzip

Under UNIX there are some widely used applications to archive and compress files. tar is used to make archives, that is collections of files. 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

Files can be compressed to save disk space 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 don't make archives, but compress files individually. To decompress, use:

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

RMP.

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

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

To extract the files from a .tar.gz archive:

$ tar -zxf <file.tar.gz>