Home >Operation and Maintenance >Linux Operation and Maintenance >What is the difference between the parameters r and R of cp in linux?
Difference: 1. "cp -r" copies both files and folders in the current directory, while "cp -R" only copies files in the current directory and does not copy the current directory. 2. "cp -r" The folder containing files will overwrite the folder with the same name without files, and the files will also be overwritten, while "cp -R" will not overwrite the folder containing the content, but it will overwrite An empty file with the same name; 3. "cp -r" does not use the file suffix name as the basis for identification, but "cp -R" uses the file suffix name as the basis for identification.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
The difference between the cp -r and -R of the LINUX command is: different copying, different coverage, and different identification basis.
1. Copy different files
cp -r: cp -r copies the files in the current directory files, and also copies folders in the current directory.
-R: -R only copies files in the current directory, not folders in the current directory.
2. Cover different
cp -r: cp -r contains files Folders will overwrite folders with the same name that do not contain files, and files will also be overwritten.
-R: -R will not overwrite folders with contents, but will overwrite empty files with the same name.
3. Different identification basis
Extension:
Linux cp (full spelling in English :copy file) command is mainly used to copy files or directories. Syntaxcp [options] source destor
cp [options] source... directoryParameter description:
The above is the detailed content of What is the difference between the parameters r and R of cp in linux?. For more information, please follow other related articles on the PHP Chinese website!