1. Function of CP
Copy one or more files (or directories) to a destination
2. Example
1) Copy multiple source files to destination at once
#cp/MNT/HGFS/DOC/{1,2,3,4,5}.TXT/ROOT/LDJ
2) Copy only the linked files to a new location, without copying the actual linked files
#cp-D libc.so.6/copy-only symbolic connection, do not copy the actual file (or-P,--preserve=links These three kinds can be)
#sudo cp-p ~/opt/stardict/*link/usr/share/stardict/dic/
3) Copy the actual file that the actual link points to
#cp-L File1-link file2
4) Create a soft link (symbolic Link) for file file1 file2
#cp-S file1 file2//file2->file1
With
#ln-S File1 file2
5) Create a hard link to the file file1 file2
#cp-L file1 file2//file1 and file2 are the same file
6) Keep the properties of the file (Ownership,mode,timestamp)
#cp-P file1 file2//or--preserve=mode,ownership,timestamps
7) Keep all properties of the file
#cp-a file1 file2//or –preserve=all or-DPR
8) Copy when the source file is newer than the target file
#cp-U file1 file2//or –update
3. Attention
Copy a symbolic link to another place, to keep the symbolic link still valid, the source symbolic link created must have path information and cannot use a relative path (./)
=-=-=-=-=
Powered by Blogilo
Usage of CP