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 directly overwriting commands by cp under CentOS

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

Share

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

This article introduces the relevant knowledge of "the method of directly overwriting commands under cp under CentOS". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

When cp is overwritten, no matter what parameter-f is added or whether the prompt is overwritten or not, copy directly the files in the test directory to the test1 directory without packaging.

Cp-r test/* test1

When you execute the above command, every file that exists in test1 prompts you whether to overwrite

Cp-rf test/* test1

When you execute the above command, every file that test1 exists will no longer be prompted

This is the ideal state we want, but sometimes with-f added, there will be a hint.

Because the server will add the alias alias cp='cp-iTunes by default, when you execute cp, you actually execute cp-I.

You can see it under alias.

# alias

Alias cp='cp-i'

You can solve the problem with the following

# vi ~ / .bashrc

Add "#" before alias cp='cp-i' and comment out the line,: wq! Save and launch, and then log in again.

Next time you use cp-rf, you can directly overwrite the existing files.

Of course, if you don't want to change the alias, you can escape it,\ cp-rf.

This is the end of the content of "how to directly overwrite the command under cp under CentOS". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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