Linux Study Notes-cp command (copy)

Source: Internet
Author: User

Linux Study Notes-cp command (copy)

Cp: English Name copy.

1. Command Format:

Cp [Option] source file or directory target file or directory cp [Option] source file 1 source file 2 source file 3... target directory

2. Common options:

"Cp-a" is equivalent to "cp-pdr" "cp-B". If a file with the same name already exists in the target directory, back up "cp-d" before deleting or overwriting the target file. If the source file is a linked file, copy the link property "cp-f" to force the file, if there are duplicates, the user will not be asked, and the forced copy "cp-I" if the target file already exists, the system will first confirm "cp-l" to create a hard link during overwriting, it is equivalent to "ln" command "cp-p" Copied together with file attributes "cp-r" recursive replication, used for directory replication behavior "cp-s" to create soft links, it is equivalent to the "ln-s" command, that is, the shortcut "cp-u" in windows. If the target file is earlier than the source file, it is copied and updated.

3. Common examples

1) copy the file to another location

2) Copy multiple files at the same time

3) copy a directory

<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4NCjxwcmUgY2xhc3M9 "brush: SQL;"> 4) create a hard link

5) create a soft link

6) if a file with the same name already exists in the target directory, a backup file is created.

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.