A method of enforcing override using CP command in Linux

Source: Internet
Author: User

When the CP is copied, if it encounters a file with the same file name, it will ask whether or not to overwrite and let you enter Yes or No. Why? This is for Linux. For security reasons, aliases are used on the CP command. That is, you enter only the CP command, in fact, you enter the system is "cp-i." The i is the interactive meaning, constantly asking you whether to overwrite. Therefore, the CP mandatory coverage has the following three methods.

Method One:

Enter the alias command to see that the CP alias is used inside the system.

The code is as follows:


< p> alias cp= ' Cp-i '

Enter the Unalias CP command to remove the alias.

The code is as follows:

#unaslias CP

(This is only a temporary cancellation of the CP alias, not permanent)

The code is as follows:

#cp a test/a

Oh, this is normal.

Method Two:

Enter the CP command, which also cancels the CP alias.

The code is as follows:

#cp a Testa

Oh, so the use is as well.

This method is equivalent to using the absolute path of the executable file directly with the CP command

The code is as follows:

#/bin/cp A.txt

Method Three:

Enter YES|CP a testa and use the pipe to enter yes automatically.

The code is as follows:

#yes | CP a Testa

See, automatically make a pile of yes, for you to enter.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.