c
cp(1) | cp(1) |
NAME
cp - copy ®les and directory subtrees
SYNOPSIS
cp
cp
cp
DESCRIPTION
cp copies:
∙®le1 to new or existing new_®le,
∙®le1 to existing dest_directory,
∙®le1, ®le2, ... to existing dest_directory,
∙directory subtree directory1, to new or existing dest_directory. or
∙multiple directory subtrees directory1, directory2, ... to new or existing dest_directory.
cp fails if ®le1 and new_®le are the same (be cautious when using shell metacharacters). When destination is a directory, one or more ®les are copied into that directory. If two or more ®les are copied, the destination must be a directory. When copying a single ®le to a new ®le, if new_®le exists, its contents are des- troyed.
If the access permissions of the destination dest_directory or existing destination ®le new_®le forbid writing, cp aborts and produces an error message ``cannot create ®le''.
To copy one or more directory subtrees to another directory, the
If new_®le is a link to an existing ®le with other links, cp overwrites the existing ®le and retains all links. If copying a ®le to an existing ®le, cp does not change existing ®le access permission bits, owner, or group.
When copying ®les to a directory or to a new ®le that does not already exist, cp creates a new ®le with the same ®le permission bits as ®le1, modi®ed by the ®le creation mask of the user if the
Options
Usually normal ®les and directories are copied. Character special devices, block special devices, network special ®les, named pipes, symbolic links, and sockets are copied, if the user has access to the ®le; otherwise, a warning is printed stating that the ®le cannot be created, and the ®le is skipped.
dest_directory should not reside within directory1, nor should directory1 have a cyclic directory structure, since in both cases cp attempts to copy an in®nite amount of data.
Section 1−114 | − 1 − |