Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cat(1)

pr(1)

mv(1)

cp(1)

Name

cp − copy file data

Syntax

cp [ −f ] [ −i ] [ −p ] file1 file2

cp [ −f ] [ −i ] [ −p ] [ −r ] file... directory

cp [ −f ] [ −i ] [ −p ] [ −r ] directory... directory

Description

The cp command copies file1 onto file2. The mode and owner of file2 are preserved if it already existed; the mode of file1 is used otherwise.  Note that the cp command will not copy a file onto itself.

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

In the third form, one or more source directories are copied into the destination directory with their original file names. 

Options

−fForces existing destination pathnames to be removed before copying, without prompting for confirmation.  The −i option is ignored if the −f option is specified. 

−iPrompts user with the name of file whenever the copy will cause an old file to be overwritten. A yes answer will cause cp to continue. Any other answer will prevent it from overwriting the file.

−pPreserves (duplicates) in the copies the modification time, access time, file mode, user ID, and group ID as allowed by the permissions of the source files, ignoring the present umask. 

−rCopies directories. Entire directory trees, including their subtrees and the individual files they contain, are copied to the specified destination directory. The directory, its subtrees, and the individual files retain their original names. For example, to copy the directory reports, including all of its subtrees and files, into the directory news, enter the following command:

cp -r reports news

See Also

cat(1), pr(1), mv(1)

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