cp cocoon butterflymakes a duplicate of the file cocoon and gives it the name butterfly. Note that the filenames can include pathnames as well.
cp /home/cernan/taylor/tex/contract ../contract.bakmakes a copy of the file contract found in the /home/cernan/taylor/tex directory and places it one directory level above the working directory in a file called contract.bak.
If /home/cernan/taylor/tex is a directory, then
cp report /home/cernan/taylor/texwill place a copy of report in the /home/cernan/taylor/tex directory with the name report.
cp /home/cernan/taylor/tex/headlines .will copy the file headlines in the /home/cernan/taylor/tex directory into the working directory. The name will remain unchanged.
cp /home/cernan/taylor/tex/* .will copy all the files (but not the subdirectories) in /home/cernan/taylor/tex into the working directory. You can copy all the subdirectories in the directory and files contained in them by using the -r (recursive) flag as follows:
cp -r /home/cernan/taylor/tex/* .Another useful flag is the -i (interactive) flag which prompts you if you are about to overwrite an existing file.
© 1993-2000 Christopher C. Taylor