cp - copy files


cp file1 [file2 ...] targer


If target is the name of a file, then this command copies the contents of the source file1 to target. Under no circumstances can file1 and file2 be the same. If target is a directory, then cp copies one or more source files to that directory keeping the original file names.

If a target file does not exist, cp creates it giving it the same permissions as the source file but only allocating as many blocks as required by the contents of the source. If the target file exists and is writeble, its mode is changed to that of the source and its size is changed to the minimum required by the source.


copy file x to file y:
cp x y
copy file a and b into /save/a and /save/b:
cp a b /save
concatenates the first two files and places the result on the third.


mv(1F) , rm(1F)


If the target is write protected, the target file is unchanged, and an error message is printed.