Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cp(1) — HP-UX 5.50

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cpio(1)

link(1M)

rm(1)

chmod(2)

CP(1)  —  HP-UX

NAME

cp, ln, mv − copy, link or move files

SYNOPSIS

cp [ −r ] file1 [ file2 ...] target
ln [ −f ] file1 [ file2 ...] target
mv [ −f ] file1 [ file2 ...] target

DESCRIPTION

File1 is copied (linked, moved) to target. Under no circumstance can file1 and target be the same (take care when using sh(1) metacharacters). If target is a directory, then one or more files are copied (linked, moved) to that directory.  If two or more files are specified for any of these commands (not counting target), then target must be a directory.  If target is a file, its contents are destroyed. 

If the −r option is specified, then for each source directory cp copies the subtree rooted at that directory to target. If target exists it must be a directory, in which case cp creates a directory within target with the same name as source, and then copies the subtree rooted at source to target/source. It is an error if target/source already exists.  If target does not exist, cp creates it and then copies the subtree rooted at source to target. Note that cp −r will not merge subtrees.  Target should not reside beneath source, and source should not have a cyclic directory structure, since in these cases cp will attempt to copy an infinite amount of data. 

If mv or ln determines that the mode of target forbids writing, it will ask permission to overwrite the file.  This is done by printing the mode (see chmod(2)) followed by the first letters for the words yes and no in the current native language, asking for a response, and reading the standard input for one line.  If the response begins with the first of the choices displayed and if permissible, the operation occurs; if not, the command exits.  No questions are asked and the mv or ln is done when the −f option is used or if the standard input is not a terminal. 

If file1 is a directory, mv renames file1 to target only if the two directories have the same parent.  Ln does not permit file1 to be a directory.  Cp permits file1 to be a directory only if the −r option is specified.  If file1 is a file and target is a link to another file with links, the other links remain and target becomes a new file.  When using cp, if target is not a file, a new file is created which has the same mode as file1 except that the sticky bit is not set unless you are super-user; the owner and group of target are those of the user.  If target is a file, copying a file into target does not change its mode, owner, nor group.  The last modification time of target (and last access time, if target did not exist) and the last access time of file1 are set to the time the copy was made.  If target is a link to a file, all links remain and the file is changed. 

You cannot use mv to perform the following operations:

rename either the current working directory or its parent directory using the "." or ".." notation;

rename a directory such that its new name is the same as the name of a file contained in that directory. 

SEE ALSO

cpio(1), link(1M), rm(1), chmod(2). 

BUGS

If file1 and target lie on different file systems, mv must copy the file and delete the original.  In this case the owner becomes that of the copying process and any linking relationship with other files is lost.  Ln cannot not create hard links across file systems. 

INTERNATIONAL SUPPORT

8- and 16-bit data, 8-bit filenames, messages. 

Hewlett-Packard Company  —  Version B.1,  May 11, 2021

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