Linux command to copy the folder to use, cp and mv command options

cp and mv command options


learning target

  • Options can say the command to copy the folder used

1. cp command options

Command Options Explanation
-i Interactive prompts
-r Recursively copy directory and its contents
-v After displaying copy path described
-a Original rights reserved file

cp -i command options renderings:

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-fg0UChBd-1583850653470) (imgs / cp% E9% 80% 89% E9% A1% B9-1.png )]

cp -r command options renderings:

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-b94fdwYd-1583850653471) (imgs / cp% E9% 80% 89% E9% A1% B9-2.png )]

cp -v command options renderings:

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-vViK2KE7-1583850653471) (imgs / cp% E9% 80% 89% E9% A1% B9-3.png )]

cp -a command options renderings:

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-2yYDEji9-1583850653472) (imgs / cp% E9% 80% 89% E9% A1% B9-4.png )]

-a option Description:

  • -a option also supports copy folder and file permissions folder is not lost

2. mv command options

Command Options Explanation
-i Interactive prompts
-v Displayed after the movement path described

mv -i command options renderings:

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-b2asZYlX-1583850653472) (imgs / mv% E9% 80% 89% E9% A1% B9-1.png )]

mv -v command options renderings:

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-FILuy6v1-1583850653473) (imgs / mv% E9% 80% 89% E9% A1% B9-2.png )]

3. Summary

  • Copy protected file is used covered "cp -i" operation
  • Copy folders using "cp -r" operation, copy the folder and file permissions are not lost use "cp -a" operation.
  • Use cover to prevent movement of the file "mv -i" operation
  • Move Folder direct use "mv" can, "mv" also to rename files and folders.
Published 698 original articles · won praise 929 · views 120 000 +

Guess you like

Origin blog.csdn.net/qq_35456045/article/details/104785336
Recommended