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.
The main advantage of
TYPE is that you can browse files
in both directions. It also accepts several commands that are issued
pressing a key. The most useful are:
qto leave the browser;
hgives you extensive help;
gto go to beginning of file,
Gto the end, number+
gto go to line `number' (e.g.
%to move to that percentage of the file;
/patternsearches forwards for `pattern';
nsearches forwards for the next match;
m+letter marks current position (e.g.
'+letter go to the marked position.
:eexamines a new file;
!commandexecutes the shell command.
The lack of version numbers in files can be easily overcome by using RCS (Revision Control System). This allows you to maintain several versions of the same file, and offers many more advantages. I'll only explain the very basics of this powerful version control system.
The most important commands are
co. The first (``check
in'') is used to commit the changes you have done to your file, and create a
new version. The second (``check out'') is used to obtain a working copy of
your file from the RCS system, either to modify it or simply use it for
browsing, printing, or whatever.
Let's see an example. First of all you create an initial revision of
your file, using your favourite editor. Let's suppose that the file you'll
have under RCS control is called
project.tex. Follow these steps:
RCS/in the directory containing
RCS/will contain the revision control file;
project.texunder RCS control, issue the command
$ ci project.tex RCS/project.tex,v <-- project.tex enter description, terminated with a single '.' or end of file: NOTE: This is NOT the log message! >>
Now the file
initial revision: 1.1 done
project.texhas been taken over by RCS.
Whenever you want to use, but not modify, the latest version of project.tex, you issue the command
$ co project.tex RCS/project.tex,v --> project.tex revision 1.1 done
This extracts the latest version (read only) of your file. Now you can browse it, or compile it with tex, but you can't modify it.
When you want to modify your file, you must obtain a ``lock'' on it. This means that RCS knows that you're about to make a newer version. In this case, you use the command
$ co project.tex RCS/project.tex,v --> project.tex revision 1.1 (locked) done
You now have a working copy you can modify with your editor. When you're done editing it, you check it in again to commit the changes:
$ ci project.tex RCS/project.tex,v <-- project.tex new revision 1.2; previous revision: 1.1 enter log message, terminated with a single '.' or end of file: >> (enter your description here) >> . done
If you want to change the version number, type
ci -f2.0 project.tex.
If you want to see the history of the changes in project.tex, issue
$ rlog project.tex
To extract an older version of your file (say, version 1.2 when you're working on 1.6), issue
$ co -r1.2 project.tex
Be aware that this overwrites your existing working file, if you have one. You may do:
$ co -r1.2 -p project.tex > project.tex.1.2
Under UNIX there are some widely used applications to archive and
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
$ 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>
unzip utilities are also available. Files
.tgz (archived with
gzip) are very common in the UNIX world. Here's how to
list the contents of a
$ gzip -dc <file.tar.gz> | tar tf - | less
To extract the files from a
$ gzip -dc <file.tar.gz> | tar xvf -