From VMS to Linux HOWTO: Useful Programs
10. Useful Programs10.1 Browsing Files: lessYou'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 less over 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:first of all, press q to leave the browser;h gives you extensive help;g to go to beginning of file, G to the end, number+g
to go to line `number' (e.g. 125g), number+% to move to that
percentage of the file;/pattern searches forwards for `pattern'; n searches
forwards for the next match; ?pattern and N search backwards;m+letter marks current position (e.g. ma); '+letter go
to the marked position.:e examines a new file;!command executes the shell command.10.2 RCS in a NutshellThe 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 ci and 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:make a subdirectory called RCS/ in the directory containing
project.tex. RCS/ will contain the revision control file;to put project.tex under 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!
>>you will write a line or more containing a description of the
contents of your file. End it with a line containing a '.' by itself, and
you'll see
initial revision: 1.1
doneNow the file project.tex has been taken over by RCS.Using the latest versionWhenever 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
doneThis 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.Creating a new versionWhen 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)
doneYou 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)
>> .
doneIf you want to change the version number, type ci -f2.0 project.tex.Comparing versionsIf you want to see the history of the changes in project.tex, issue
$ rlog project.texUsing an old versionTo 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.210.3 Archiving: tar & gzipUnder 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> | lessFiles 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:
$ gzip -dc <file.tar.gz> | tar tf - | lessTo extract the files from a .tar.gz archive:
$ gzip -dc <file.tar.gz> | tar xvf -
O
Wyszukiwarka
Podobne podstrony:
vms to linux howto 6 orpzzxmiy5oizudwzslh4p4kfunjtgy6prdxrwi orpzzxmiy5oizudwzslh4p4kfunjtgy6prdxrwivms to linux howto 5zv2dnz24mcm6ujoqsm4mrsb6v5tbjxddhtqu5a 5zv2dnz24mcm6ujoqsm4mrsb6v5tbjxddhtqu5avms to linux howto 14 cm5l4wlt7qtalypc34eimd4eyk3x4un7tij3hty cm5l4wlt7qtalypc34eimd4eyk3x4un7tij3htvms to linux howto 1 wocqfdo5putowphbtwsosy4r4gw6gaacb7d53sy wocqfdo5putowphbtwsosy4r4gw6gaacb7d53syvms to linux howto 1 wocqfdo5putowphbtwsosy4r4gw6gaacb7d53sy wocqfdo5putowphbtwsosy4r4gw6gaacb7d53sydos win to linux howto 10vms to linux howto 7 l7kbq6xnrrkkazl2tvmbvm25fe7zo7v4mctzfnq l7kbq6xnrrkkazl2tvmbvm25fe7zo7v4mctzfnqvms to linux howto 5 5gnldmqe4ayl45wuhxe72clxgmyt3dmyl2nhuza 5gnldmqe4ayl45wuhxe72clxgmyt3dmyl2nhuzavms to linux howto 4 rbjwb2i6cf666xqwnvyy27m6ng2p5mcva5iwuji rbjwb2i6cf666xqwnvyy27m6ng2p5mcva5iwujivms to linux howto 13 vodijua4gjnr2qhakcvaroutkbkmgr6citxjlsq vodijua4gjnr2qhakcvaroutkbkmgr6citxjlsvms to linux howto 12 3zwwy2c6lf7cewiq6w4rky22mfgbbxm6ye6afgi 3zwwy2c6lf7cewiq6w4rky22mfgbbxm6ye6afgvms to linux howto 9 xaamogxatm2cxcqhivrdyhbvz2pr2mc6ga6cvsq xaamogxatm2cxcqhivrdyhbvz2pr2mc6ga6cvsqvms to linux howto 3 j2ak5ify4fmhciyje7dg62qxfdiubsxnurdjfoy j2ak5ify4fmhciyje7dg62qxfdiubsxnurdjfoyvms to linux howto 8 5xpmcvpfyam3vmcht7xpclkcvtfrqznpaczc4dy 5xpmcvpfyam3vmcht7xpclkcvtfrqznpaczc4dyvms to linux howto 2 sfrebjzzkdkbqc3ir7ssldvoxfxzfrj26icflja sfrebjzzkdkbqc3ir7ssldvoxfxzfrj26icfljavms to linux howto 11 fg7v4xjcp5htxy34xvioskhxdbhi3beb3im7xfy fg7v4xjcp5htxy34xvioskhxdbhi3beb3im7xfdos win to linux howto 6dos win to linux howtodos win to linux howto 7więcej podobnych podstron