Usage of CP

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.