Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of directly overwriting commands by cp under CentOS

Shulou Source: shulou.com Published: 2022-06-01 12:15:07 10月27日 Update

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!

Tags: Commands files prompts methods contents aliases situations more directories knowledge faceted practical learned next parameters dilemmas actual articles servers cases Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux vpn Shulou Information Shulou Tech Info MariaDB