UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 18.1 Overview of CommandsChapter 18
The RCS Utility
Next: 18.3 General RCS Specifications
 

18.2 Basic Operation

Normally, you maintain RCS files in a subdirectory called RCS, so the first step in using RCS should be:

mkdir RCS

Next, you place an existing file (or files) under RCS control by running the check-in command:

ci file

This creates a file called file,v in directory RCS. file,v is called an RCS file, and it will store all future revisions of file. When you run ci on a file for the first time, you are prompted to describe the contents. ci then deposits file into the RCS file as revision 1.1.

To edit a new revision, check out a copy:

co -l file

This causes RCS to extract a copy of file from the RCS file. You must lock the file with -l to make it writable by you. This copy is called a working file. When you're done editing, you can record the changes by checking the working file back in again:

ci file

This time, you are prompted to enter a log of the changes made, and the file is deposited as revision 1.2. Note that a check in normally removes the working file. To retrieve a read-only copy, do a check out without a lock:

co file

This is useful when you need to keep a copy on hand for compiling or searching. As a shortcut to the previous ci/co, you could type:

ci -u file

This checks in the file but immediately checks out a read-only copy. To compare changes between a working file and its latest revision, you can type:

rcsdiff file

Another useful command is rlog, which shows a summary of log messages. System administrators can use the rcs command to set up default behavior of RCS.


Previous: 18.1 Overview of CommandsUNIX in a Nutshell: System V EditionNext: 18.3 General RCS Specifications
18.1 Overview of CommandsBook Index18.3 General RCS Specifications

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System