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