The method of overriding and not prompting by linux
Today, the editor shares with you the method of linux overlay without prompting. I believe many people do not know much about it. In order to let you know more about the method of linux overlay without prompting, I have summarized the following contents for you. Let's look down together. I'm sure you'll get something.
Question:
When cp overwrites, no matter what parameter-f is added or whether the prompt is overwritten or not, you can press Y to confirm when there are few files, but it is hard to say when there are a lot of files. The problem of overwriting prompts can be solved by using the following methods.
For example: copy the files in the zongguofeng directory to the linuxzgf directory
[root@linuxzgf ~] # cp zongguofeng/* linuxzgf
Cp: does it overwrite "linuxzgf/1.txt"?
When you execute the above command, each file that exists in the linuxzgf folder prompts you whether to overwrite
[root@linuxzgf ~] # cp-rf zongguofeng/* linuxzgf
Cp: does it overwrite "linuxzgf/1.txt"?
After adding-f, there is still this hint.
After searching on the server, it is found that an alias has been added to the default system as follows:
[root@linuxzgf] # alias alias cp='cp-i'
You can see that when cp is executed, the cp-I parameter is actually executed.
Solution:
Method 1: modify the bashrc file to disable the alias of cp
[root@linuxzgf] # vi ~ / .bashrc
Add a "#" 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: directly enter the command to achieve
[root@linuxzgf ~] # cp-rf zongguofeng linuxzgf/cp: whether to overwrite "linuxzgf/zongguofeng/user_add.sh"? [root@linuxzgf ~] #\ cp-rf zongguofeng linuxzgf [root@linuxzgf ~] #
On the implementation of linux coverage does not prompt the method to share here, I hope that the above content can have a certain reference value for everyone, you can learn to apply. If you like this article, you might as well share it for more people to see.