https://invisible-island.net/ded/cm_tools/
copy - file/directory copy utility
copy [options] file1 file2
copy [options] file ... directory
Copy is an extension of the basic POSIX cp utility. It copies files,
preserving their modification date.
Copy copies file1 onto file2. It preserves the existing mode of file2.
If file2 did not exist, copy uses the mode of the source file.
Copy can also be used to copy one or more files into directory, without
changing their original filenames. It refuses to copy a file onto
itself.
Except for symbolic links, file2 will be set to the same modification
date as file1. The owner of the file will be the same as the owner of
the process which invokes copy. Unless the "-i" option is used, copy
ignores permissions of the (previous) destination file.
Copy recognizes options similar to those of cp, but with extensions:
-a include dot-files (names beginning with '.'). This is the default.
Use this option to override -z, e.g., in a script which presets
that option.
-d all names given are treated as the destination; the source names
are obtained by taking the leaves and looking for them in the
current working directory. This is provided to simplify
installation of files in a directory.
-f forces copy into protected directories by temporarily changing the
destination protection.
-i prompt with the name of the file whenever the copy will cause an
old file to be overwritten. A "y" answer causes copy to continue.
Any other answer prevents it from overwriting the file.
-l copy the files which symbolic links point to, rather than copying
the links themselves.
-m permits you to merge directories. If the source and destination
are directories, copy will normally create a new directory under
the destination with the same leaf name as the source. For
example,
copy /local/bin /usr/local/bin
will create and copy into the directory "/usr/local/bin/bin" if
"/usr/local/bin" exists. Use the "-m" option to copy onto an
existing directory.
-n disables the actual creation or modification of files, and
(depending on the level of verboseness) shows the effect which the
copy command would have.
-p attempt to preserve file ownership.
-s enables the set-uid and set-gid file modes in the target.
-u copies files only if their size or modification date differs, and
links only if the link-text differs.
-U copies only files that are newer than the destination, or that do
not exist in the destination.
-v verbose mode directs copy to print the names (to standard error) of
the files which it copies.
-z omit dot-files (names beginning with '.').
-S (Linux only) tells copy that the source is on a filesystem using
local time, and that appropriate adjustments must be made in the
timestamp computation.
-D (Linux only) tells copy that the destination is on a filesystem
using local time, and that appropriate adjustments must be made in
the timestamp computation.
Copy is used exactly as one would use cp (for file-copying). Directory
copying is performed without the "-r" option of cp.
Copy recognizes the C-shell "~" (tilde) to denote the home directory of
POSIX users.
If more than two arguments are given, or if the destination ends with
"/", copy assumes that the user wants to write into an existing
directory rather than create a new one.
Copy is a C-language program which runs in a POSIX environment.
Copy is a single binary file, "copy".
Copy does not currently know how to handle special files (e.g.,
/dev/tty).
Thomas E. Dickey <dickey@invisible-island.net>
cp (1)
2025-09-28 COPY(1)