Overwrite files under Linux, how to implement direct overwrite, without prompting

Source: Internet
Author: User
Tags what parameter

Transferred from: http://w-tingsheng.blog.163.com/blog/static/2505603420124309130528/

CP coverage, no matter what parameter-f or whether the hint is overwritten, when the file is less than the time can also press Y to confirm, when a lot of files are not good to say. Use the following method to resolve the problem with the overlay prompt.

Example: Copy files from the Zongguofeng directory to the LINUXZGF directory

[email protected] ~]# CP zongguofeng/* LINUXZGF
CP: Do you want to overwrite "Linuxzgf/1.txt"?
When you execute the above command, each file that exists in the LINUXZGF folder will prompt for overwrite;

[Email protected] ~]# CP-RF zongguofeng/* LINUXZGF
CP: Do you want to overwrite "Linuxzgf/1.txt"?
Added-F, still have this hint.

Found on the server after the discovery of the default system is added to the following aliases
[[email protected] ~]# alias
Alias cp= ' Cp-i '
Can see other people, that is, when executing the CP, in fact, the implementation of the Cp-i parameters


Workaround:

Method One: Modify the BASHRC file to disable the alias of CP

[Email protected] ~]# VI ~/.BASHRC

Add the "#" comment before alias cp= ' Cp-i ', and log in again to make replication without prompting.

[Email protected] ~]# CP-RF Zongguofeng LINUXZGF
[Email protected] ~]# cp-r Zongguofeng LINUXZGF


Method Two: Direct input command can be implemented

[Email protected] ~]# CP-RF Zongguofeng linuxzgf/
CP: Do you want to overwrite "linuxzgf/zongguofeng/user_add.sh"?

[Email protected] ~]# \CP-RF Zongguofeng LINUXZGF
[Email protected] ~]#

Overwrite files under Linux, how to implement direct overwrite, without prompting

Related Article

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.