Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of overriding and not prompting by linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report