Linux copy, move overwrite file not prompt

Source: Internet
Author: User

# VI ~/.BASHRC

If you see something like this, the following commands are executed with aliases, which means that the-i parameter is automatically added

Alias rm= ' Rm-i '
Alias cp= ' Cp-i '
Alias mv= ' Mv-i '

In order to copy and move a large number of files to overwrite the target, there will not be a hint, the command should be written like this

# \cp-rf/home/21andy.com/*/www/21andy.com/

Note that the CP command is added \ , meaning that it is not allowed to run with the alias in ~/.BASHRC, i.e.-i parameter

The options for this command have the following meanings

-A This option is typically used when copying a directory. It retains links, file attributes, and recursively copies the directory, which is equal to the combination of the DPR option.

-Keep links when copying D.

-F Delete a target file that already exists without prompting.

-I and F options, in contrast, will prompt the user for confirmation before overwriting the target file. Answer y when the target file will be overwritten, is an interactive copy.

-P At this point, the CP will also copy the modified time and access rights to the new file in addition to the contents of the source file.

-R If the source file is a directory file, the CP will recursively replicate all subdirectories and files in that directory. The destination file must be a directory name at this time.

-L do not make copies, just link files.

It should be explained that in order to prevent the user inadvertently using the CP command to destroy another file, such as the user specified the target file name is an existing file name, the CP command after copying the file, the file will be the new copy of the source file overwritten, it is recommended that users use the CP command to copy files, it is best to use the I option.

Linux copy, move overwrite file not prompt

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.