Linux copy files are now directly overwritten without prompting

Source: Internet
Author: User

There are two ways to solve this problem:

Method One: Modifying the BASHRC file disables the alias of CP

[root@~]# VI ~/.BASHRC

Add the "#" comment before alias cp= ' Cp-i ', and you can implement replication without prompting after you log in again.

Method Two: When using CP command, in front back "\"

That is: [root@~]# \cp-rf Source Directory destination Folder

The options for this command have the following meanings

-A This option is usually used when copying directories. It retains the link, file attributes, and recursively copies the directory, which is equal to the combination of the DPR option.
-D Keep links when copying.
-F Deletes an existing destination file without prompting.
-I and F options, in contrast, will be prompted to confirm the user before overwriting the target file. When you answer y, the target file is overwritten and is an interactive copy.
-P In addition to copying the contents of the source file, the CP will also copy the modification time and access rights to the new file.
-R If the source file given is a directory file, the CP will recursively replicate all subdirectories and files in the directory. The destination file must be a directory name at this time.
-L do not copy, just link file.

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.