To Index

 Documented in Volume 1 of the UNIX Programmers Manual.


 % cp infile outfile
  copies the contents of infile into outfile.

  NOTE: The mv(1) command is best for moving a subtree within a file system.

  You can effect a recursive move across file systems by doing a
  `cp -r' followed by a `rm -r'.


 % cp -i fromfile tofile
  prompts if the destination file named tofile already exists.

  For the following examples, assume the following directories and
  files: d1/f1, d1/d2/f2, and d3 where d1, etc. are directories,
  and f1, etc. are files.

 % cp d1/f1 d3
  would copy the contents of d1/f3 and place it into d3/f1,


 % cp d1/all* d3
  makes a copy of all files in d1 whose names start with 'all'
  in subdirectory d3.


 % cp -r d1 d3
  would make d3/d1/f1 and d3/d1/d2/f2,


 % cp -r d1/. d3
  would make d3/f1 and d3/d2/f2.

To Index