Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cat(1V)

pr(1V)

mv(1)

rcp(1C)

CP(1)  —  USER COMMANDS

NAME

cp − copy files

SYNOPSIS

cp [ −i ] [ −p ] file1 file2

cp [ −i ] [ −p ] [ −rR ] file ... directory

DESCRIPTION

file1 is copied onto file2. The mode and owner of file2 are preserved if it already existed; the mode of the source file, modified by the current umask, is used otherwise.

In the second form, one or more named files are copied into directory with their original filenames. 

cp refuses to copy a file onto itself. 

OPTIONS

−i Interactive: prompt the user with the name of the file whenever the copy would overwrite an old file.  Answering with ’y’ means that cp should go ahead and copy the file.  Any other answer will prevent cp from overwriting the file. 

−p Preserve: attempt to preserve (duplicate) in its copies the modification times and modes of the source files, ignoring the present umask.

−r

−R Recursive: if any of the source files are directories, cp copies each subtree rooted at that name; in this case the destination must be a directory. 

EXAMPLES

To make a backup copy of goodies:

% cp goodies old.goodies

To copy an entire directory hierarchy:

% cp −r /usr/wendy/src  /usr/wendy/backup

However, BEWARE of a recursive copy like this one:

% cp −r /usr/wendy/src  /usr/wendy/src/backup

which keeps copying files until it fills the entire file system. 

SEE ALSO

cat(1V), pr(1V), mv(1), rcp(1C)

Sun Release 3.2  —  Last change: 16 February 1984

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026