Home > Article > Operation and Maintenance > Linux implementation coverage does not prompt
Question:
When overwriting with cp, no matter what parameter -f or the like is added, it will still prompt whether to overwrite. When there are relatively few files, you can press Y to confirm. It is difficult to say when there are many files. Use the following method to solve the problem of overwriting prompts.
For example: Copy the files in the zongguofeng directory to the linuxzgf directory
[root@linuxzgf ~]# cp zongguofeng/* linuxzgf
cp: Do you want to overwrite "linuxzgf/1.txt"?
Execute the above command When , each file that exists in the linuxzgf folder will prompt whether to overwrite;
[root@linuxzgf ~]# cp -rf zongguofeng/* linuxzgf
cp: Do you want to overwrite "linuxzgf/1.txt"?
Added -f, There is still this prompt.
After searching on the server, I found that the alias was added in the default system as follows:
[root@linuxzgf ~]# alias alias cp='cp -i'
You can see that when cp is executed, cp is actually executed - i parameter.
(Online learning video sharing: linux video tutorial)
Solution:
Method 1: Modify the bashrc file to disable cp's alias
[root@linuxzgf ~]# vi ~/.bashrc
Add the "#" comment before alias cp='cp -i', and log in again to copy without prompting.
[root@linuxzgf ~]# cp -rf zongguofeng linuxzgf [root@linuxzgf ~]# cp -r zongguofeng linuxzgf
Method 2: Enter the command directly to achieve
[root@linuxzgf ~]# cp -rf zongguofeng linuxzgf/ cp:是否覆盖“linuxzgf/zongguofeng/user_add.sh”? [root@linuxzgf ~]# \cp -rf zongguofeng linuxzgf [root@linuxzgf ~]#
Recommended related tutorials: linux tutorial
The above is the detailed content of Linux implementation coverage does not prompt. For more information, please follow other related articles on the PHP Chinese website!