Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)
cp(1) OSS Shell and Utilities Reference Manual
NAME
cp - Copies files
SYNOPSIS
cp [-fip][-W clobber] source_file target_file
cp [-fip][-W clobber] source_file ... destination_directory
cp [-fLip][-r | -R][-W clobber][-W NOG ][-W NOE ][source_file | source_directory]
... destination_directory
FLAGS
-f Tries to unlink the destination file and proceed if a file descriptor for a
destination file cannot be obtained.
-L Forces cp to follow symbolic links; useful with the -R flag, which does
not follow symbolic links by default.
-i Requests confirmation when the copy operation requires a destination
file to be overwritten by a source file. An answer beginning with y, or the
locale’s equivalent of y, causes the cp command to overwrite the desti-
nation file and continue. Any other answer prevents overwriting of the
file.
-p Preserves for the copy the modification time, access time, file mode, user
ID, and group ID of the source, as allowed by permissions. If the user ID
and group ID cannot be preserved, no error message is displayed and the
exit value is not altered. If the original is set-user ID or set-group ID,
and either the user ID or the group ID cannot be preserved, the set-user-
ID and set-group-ID bits are not preserved in the copy’s permissions.
The -p flag cannot preserve owner ID or group ID information when
copying a file to a remote system. The resulting file is always owned by
the super ID.
-r Copies the source directory and all of the subdirectories within it. This
flag is identical to the -R flag except that special files are not treated
differently from regular files (that is, -r follows symbolic links).
If you are using the -r flag to copy the contents of one directory to
another, and if the source directory contains subdirectories that do not
exist in the destination directory, the subdirectories are created. Created
directories have the same mode as the corresponding source directory,
unmodified by the process’s file mode creation mask (umask).
This flag has been proposed for obsolescence in a future revision of the
Single UNIX standard. Use the -R flag instead to ensure portability.
-R Copies the source directory and all of the subdirectories within it. Spe-
cial file types, such as symbolic links and block and character devices,
are re-created instead of copied.
If you are using the -R flag to copy the contents of one directory to
another, and if the source directory contains subdirectories that do not
exist in the destination directory, the subdirectories are created. Created
directories have the same mode as the corresponding source directory,
unmodified by the process’s file mode creation mask (umask).
2−68 Hewlett-Packard Company 527188-004