1. To copy a file from a subdirectory to the current working directory:
cp notes/note3 sect3.txt
This copies the file note3 from the subdirectory notes to the file sect3 in the current working directory. A relative pathname "notes/note3" is used to define the source file.
2. To copy a file from another directory to the current working directory, preserving the file name:
cp /usr/lib/more.help .
This creates a copy of the file more.help in the current working directory. A full pathname "/usr/lib/more.help" is used to define the source file.
3. To copy a file from another user's directory using a relative pathname.
cp ~helper/tmp/for_john tmp/comments
This copies the file for_john from the directory tmp in which is in the home directory of the user helper, to a directory with the same name in the user's home directory. The name of this new file is comments.
Notice that a relative pathname "\~helper/tmp/for_john" is used to define the source file.