In the first synopsis form, the cp(1) utility copies the
contents of the source_file to the target_file. In
the second, third, and fourth synopsis forms, the contents of each
named source_file are copied to the destination
target_directory. The names of the files are not changed. If
cp(1) detects an attempt to copy a file to itself, the copy
will fail.
This option suppresses the check for identical file identifier
(inode) and device values on the source and destination files. This
is to counteract a problem with some Windows network redirectors
that provide random device and file identifier (ID) values. It
should only be used when copying directories (with -r) on a
networked drive. Otherwise, cp(1) may fail erroneously with
the message:
cp : destdir/foo and srcdir/foo are identical (not copied)
-f
For each existing destination path name, remove it and create a
new file, without prompting for confirmation regardless of its
permissions.
-i
Inquire before copying a file that would overwrite an existing
file. The cp(1) utility writes a prompt to the standard
error output. If the response from the standard input begins with
the character "y," the file copy is attempted.
-m
Preserve the modified and acces times from the src file. Like
-p but only preserves the times.
-p
Preserve in the copy the following attributes, as permissions
allow:
Modification time
Access time
File flags
File mode
User ID
Group ID
The following also apply to this option:
If the user ID and group ID cannot be preserved, no error
message is displayed and the exit value is not altered.
If the source file has its set user ID bit on, and the user ID
cannot be preserved, the set user ID bit is not preserved in the
copy's permissions.
If the source file has its set group ID bit on and the group ID
cannot be preserved, the set group ID bit is not preserved in the
copy's permissions.
If the source file has both its set user ID and set group ID
bits on, and either the user ID or group ID cannot be preserved,
neither the set user ID nor set group ID bits are preserved in the
copy's permissions.
-R
Copy file hierarchies, including FIFOs; this may not be
specified with the -r option.
-r
Copy file hierarchies but not including special files such as
FIFOs; this may not be specified with the -R option.
-v
Display each filename to standard output as they are being
copied.
The contents of each destination file that already exists are
overwritten if permissions allow, but its mode, user ID, and group
ID are unchanged.
In the second synopsis form, target_directory must exist
unless there is only one named source_file, which is a
directory, and the -R flag is specified.
If the destination file does not exist, the mode of the source
file is used as modified by the file-mode creation mask.
Appropriate permissions are required for file creation or
overwriting.