Linux CP forced overwrite

Source: Internet
Author: User

    • Brief introduction

CentOS cp-fr src dest, even if the addition of-F is not forced to cover, then what is the matter? One or two files OK, just lose a few yes, but what if n more files do not lose the dead? There are three solutions available below.

    • Method One

Let's enter the alias command to see what alias the system has for CP.

[[email protected] ~]# alias
Alias cp= ' Cp-i '
Alias l.= ' ls-d. *–color=auto '
Alias Ll= ' Ls-l–color=auto '
Alias ls= ' Ls–color=auto '
Alias mv= ' Mv-i '
Alias rm= ' Rm-i '
Alias Which= ' Alias | /usr/bin/which–tty-only–read-alias–show-dot–show-tilde '

then [[email protected] ~]# man CP
Look what I mean.
-i,–interactive Prompt before overwrite
Originally before the overwrite will prompt, then our solution also came out, with Unalias CP to remove the CP alias, restore pure CP.
[[Email protected] ~] #unaslias CP (This is just a temporary cancellation of the CP alias, not permanent)
[[Email protected] ~] #cp-fr src dest This will be done, will not be prompted to overwrite.

    • Method Two

Enter the \CP command, which also cancels the CP alias.
[email protected] ~]#\cp-fr src dest

    • Method Three

Enter YES|CP-FR src dest and use the pipe to enter yes automatically.
[[Email protected] ~] #yes | CP cp-fr SRC dest let the pipeline automatically input a lot of yes, you can complete the forced copy

Linux CP forced overwrite

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.