cp-copies files

 <  Day Day Up  >  

cp ”copies files

 cp [ i ] [ p ] [ r ] [ filename ... ] target 

The cp command copies filename to another target, which is either a file or directory. The filename and target cannot have the same name . If the target is not a directory, only one file may be specified before it; if it is a directory, more than one file may be specified. If target does not exist, cp creates a file named target . If target exists and is not a directory, its contents are overwritten. If target is a directory, the file(s) are copied to that directory.

Example A.15.
 1   cp file1 file2 2   cp chapter1 book 3   cp -r desktop /usr/bin/tester 

EXPLANATION

  1. Copies the contents of file1 to file2 .

  2. Copies the contents of chapter1 to the book directory. In the book directory, chapter1 has its original name.

  3. Recursively copies the entire desktop directory into /usr/bin/tester .

 <  Day Day Up  >  


UNIX Shells by Example
UNIX Shells by Example (4th Edition)
ISBN: 013147572X
EAN: 2147483647
Year: 2004
Pages: 454
Authors: Ellie Quigley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net