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