LinuxCommandLibrary

co

Check out RCS revisions

TLDR

Check out the latest revision of a file (retrieves a read-only copy)

$ co [path/to/file]
copy

Check out a file with a lock for editing
$ co -l [path/to/file]
copy

Check out a specific revision of a file
$ co -r[revision] [path/to/file]
copy

Check out a file and overwrite it if it already exists
$ co -f -l [path/to/file]
copy

Print a specific revision to stdout without creating a file
$ co -p -r[revision] [path/to/file]
copy

SYNOPSIS

co [options] file

PARAMETERS

-l
    Check out latest revision and lock it for editing (writable copy)

-r[rev]
    Check out specific revision rev; omit rev for latest

-u
    Check out latest revision and unlock (if locked by user)

-p
    Print revision to stdout instead of current directory

-q[rev]
    Quiet mode; optionally specify revision

-k[b|i|o|v|l]
    Keyword substitution modes: b (binary), i (no subst), o (old), v (value), l (local)

-M newname
    Check out as new file name newname

-L label
    Checkout revision with symbolic label label

-f
    Force checkout even if locked by another user

-I
    Interactive mode for prompts

-V
    Print RCS version and exit

-s state
    Set state of working file

-w[login]
    Specify effective user for access checks

-a logins
    List additional access list users

-e logins
    Exclude users from access list

-T
    Use working file timestamp if newer

DESCRIPTION

The co command is part of the Revision Control System (RCS), an early version control tool for Unix-like systems. It retrieves a specific revision of a file from an RCS file (typically named filename,v) and places a copy in the current directory.

By default, co checks out the most recent revision in read-only mode, suitable for viewing. The -l option creates a writable copy and locks the revision to prevent concurrent edits. After modifications, use ci to check in changes.

Key features include symbolic revision selection (e.g., via -r), keyword expansion (like $Id$ for metadata), and options for unlocking (-u) or printing to stdout (-p). RCS files store full revision history efficiently using delta storage.

Though largely replaced by modern tools like Git, co remains useful for legacy RCS repositories or simple version control needs. It requires RCS files to exist and enforces locking to manage multi-user access.

CAVEATS

RCS files must exist (e.g., file.c,v); locking enforces single-editor model, unsuitable for distributed work; deprecated in favor of Git/SVN; no network support natively.

DEFAULT BEHAVIOR

Without options, checks out latest revision read-only; expands keywords like $Id: file.c 1.1 $.

KEYWORD EXPANSION

Inserts revision info: $Log$, $Date$, $Author$, $Header$, $Locker$, $RCSfile$, $Revision$, $Source$, $State$.

EXIT STATUS

0: success; 1: error (e.g., no RCS file, lock failure).

HISTORY

Developed by Walter F. Tichy at Purdue University in 1982 as RCS 3.0; evolved through versions up to 5.7+; widely used on Unix until 1990s; POSIX.2 standardized syntax in 1992.

SEE ALSO

ci(1), rcs(1), rlog(1), rcsdiff(1), rcsmerge(1)

Copied to clipboard