Linux commands are used to copy, move files and directories

Copy, move files and directories command


learning target

  • Linux commands can be used to copy and move files

1. The use of copy, move files and directories command

command Explanation
cp Copy files, copy directory
mv Move files, mobile directory, rename

cp command 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-IkkLiO9r-1583850276678) (imgs / cp.png)]

Description:

  • Copy of the catalog need to add -r option, -r recursively copy directory and its contents represent

mv commands file renderings
Here Insert Picture Description

mv commands directory 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-Ha9rfexX-1583850276679) (imgs / mvml.png)]

mv command is the name of the same name 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-tFhD56YL-1583850276680) (imgs / rename.png)]

2. Summary

  • cp: copy directories need to add the -r option
  • mv: moving directories do not need to add options
  • mv: command can also rename files and directories
Published 698 original articles · won praise 929 · views 120 000 +

Guess you like

Origin blog.csdn.net/qq_35456045/article/details/104785171