Linux CP Command

Source: Internet
Author: User

CP command

CP--Copy copy

Copy file

Format: CP source file Destination file

650) this.width=650; "src=" Http://oqjg6c4c1.bkt.clouddn.com/1496737976647.jpg "alt=" CP file "style=" Border-style:none ; "/>

So easy~

Copy Directory

format: cp-r source directory target directory (and rmdir , you need to add   -r   option)

a convention: When the CP directory, the final     all to be entered. Avoid late-stage problems

650) this.width=650; "src=" Http://oqjg6c4c1.bkt.clouddn.com/1496738801379.jpg "alt=" convention "style=" Border-style:none; " />

650) this.width=650; "src=" Http://oqjg6c4c1.bkt.clouddn.com/1496738670615.jpg "alt=" CP directory "style=" Border-style:none ; "/>

Some points of note for the CP command

which cp

650) this.width=650; "src=" Http://oqjg6c4c1.bkt.clouddn.com/1496739384919.jpg "alt=" which CP "style=" Border-style: none; "/>

CP command is aliased, with a RM the command, ask if you want to delete a file.

chestnuts:

1. txt files already exist under the current/tmp/directory, if we do it again   , then this option will work.

650) this.width=650, "src=" http://oqjg6c4c1.bkt.clouddn.com/1496739813230.jpg "alt=" tmp under 1.txt "style=" Border-style:none; "/>

650) this.width=650; "src=" http://oqjg6c4c1.bkt.clouddn.com/1496739940138.jpg "alt=" asks "style=" Border-style:none; " />

If you do not want this query, you can use the absolute path of the CP directly to operate

650) this.width=650; "src=" Http://oqjg6c4c1.bkt.clouddn.com/1496740006930.jpg "alt=" did not ask "style=" Border-style:none ; "/>

For the copy file, whenever the file already exists, will ask, then for the copy directory, is the case the same?

Chestnuts:

650) this.width=650; "src=" http://oqjg6c4c1.bkt.clouddn.com/1496740469035.jpg "alt=" tmp directory "style=" Border-style: none; "/>

cp-r/tmp/allin//tmp/allin1/, verify the problem.

650) this.width=650, "src=" http://oqjg6c4c1.bkt.clouddn.com/1496740615717.jpg "alt=" result did not ask "style=" Border-style: none; "/>

So let's see what happens to the structure of the current two directories.

650) this.width=650, "src=" http://oqjg6c4c1.bkt.clouddn.com/1496741004458.jpg "alt=" Directory Change "style=" Border-style: none; "/>

explanation CP Command, when replicating directories, if the target directory (/allin1/) already exists, it does not overwrite the target directory, but instead puts the source directory (/allin/), copied intact to the existing target directory (/allin1/). When you perform such an operation again, the query does not appear to overwrite.

650) this.width=650; "src=" Http://oqjg6c4c1.bkt.clouddn.com/1496741629055.jpg "alt=" The third execution of "style=" Border-style: none; "/>


This article is from the "Linux Road" blog, make sure to keep this source http://allin28.blog.51cto.com/12931477/1933851

Linux CP Command

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.