"Linux" Linux CP implementation forced overlay __php

Source: Internet
Author: User

Found in Fedora 10/ubutun with cp-fr src dest, even if the addition of-F can not be forced to cover, then what's going on. One or two file is OK say, lose a few yes, but if n multiple files how to do, that still don't lose the dead. There are three solutions available below. Method One

We enter the alias command to see what alias the system has to the CP.

[Root@localhost ~]# 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 [Root@localhost ~]# Mans CP
Let's see what I mean.
-i,–interactive Prompt before overwrite
Before the cover will be prompted, then our solution is also out, with Unalias CP to remove CP alias, restore pure CP.
[root@localhost ~] #unaslias CP (This is a temporary cancellation of CP alias, not permanent)
[root@localhost ~] #cp-fr src dest The next line, will not be prompted to overwrite. Method Two

Enter the \CP command, which also cancels the CP alias.
[root@localhost ~]#\cp-fr src dest Method III

Enter YES|CP-FR src dest and use the pipe to automatically enter Yes.
[root@localhost ~] #yes | CP cp-fr SRC dest   let the pipeline automatically enter a large pile of yes, you can complete the forced replication.
that someone will ask how the DOS copy command to implement the forced copy. The answer is
used to xcopy/y src dest for forced replication.

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.