[Top] [Prev] [Next]

cp - copy files

cp  	fromfile tofile
cp  	fromfile... todir
cp -r 	fromdir... todir


In the first form, fromfile is any name and tofile is any name except an existing directory.

In the second form, the commands copy one or more fromfiles into a todir under their original file names, as if by a sequence of commands in the first form. For example:


cp f1 dir/f1; cp f2 dir/f2

When the cp command copies the contents of plain (non-directory) files fromfile to tofile, the mode and owner of tofile are preserved if it already exists; otherwise the mode of fromfile is used.


The -r option directs cp to recursively copy the named directories (fromdir's) to the target direction (todir), the last entry on the command line.


This option should not be used on file systems with cycles in the namespace.


The cp command refuses to copy files onto themselves.

See Also
cat - concatenate files

stat, fstat, fwstat, wstat - get and put file status in Chapter 8

[Top] [Prev] [Next]

Copyright © 1996,Lucent Technologies, Inc. All rights reserved.