COHERENT manpages

This page displays the COHERENT manpage for cp [Copy a file].

List of available manpages
Index


cp -- Command

Copy a file
cp [ -d ]  oldname newname
cp [ -d ]  file1 ... fileN directory

cp copies files.   In its first form, cp copies  the contents of oldname to
newname,  which it  creates if  necessary.  If newname  is a  directory, cp
copies oldname to a file of the same name in directory newfile.

In its  second form, cp  copies each file,  from file1 through  fileN, into
directory.

With the -d option, cp preserves the date (modification time) of the source
file or  files on the target  file or files.  By  default, target files get
the current time.

A file cannot be copied to itself.

See Also

commands,
cpdir,
ksh,
mv,
sh,
wildcards

Notes

If you use  cp to copy a file into  another existing file, the newly copied
file takes on  the permissions of the file into  which the text was copied.
For  example, consider  the files  foo  and bar,  whose permissions  are as
follows:

    -rw-r--r--  1 fred       user            40 Tue Apr 14 18:19 bar
    -rw-r-----  1 fred       user          1816 Tue Apr 14 20:53 foo

If you use cp to copy foo into bar, then typing ls -l shows the following:

    -rw-r--r--  1 fred       user          1816 Tue Apr 14 21:37 bar
    -rw-r-----  1 fred       user          1816 Tue Apr 14 20:53 foo

bar now  has exactly the  same contents as  foo but retains its  old set of
permissions.