September 2018
Beginner
186 pages
4h 30m
English
The cp command is used to copy a file or set of files to a target directory, optionally providing it with a new name:
$ ls oldfile $ cp oldfile newfile $ ls oldfile newfile
The new file in this case is truly a copy; you can change data in either the old or new file, and it won't affect data in the other.
If you specify more than two arguments after the options, with the last one being a directory, cp will copy all of the files before the last one into the directory name in the last argument:
$ cp file1 file2 file3 dir
cp with no options cannot copy directories ...
Read now
Unlock full access