Move or copy files (folders) - ubuntu operation commands

1. Move a folder to another folder

sudo mv 文件名 目标文件夹路径
  • Prerequisite: This command must be executed in the directory of the file to be moved, and there cannot be a folder under the folder.

2. Copy a folder (can contain folders) to another folder

sudo cp -r 文件名 目标文件夹路径 
  • -r means recursion. Add -r when deleting a folder.
  • Prerequisite: This command must be executed in the directory of the file to be moved, but there can be folders under the folder.

3. Copy a file to another path

sudo cp 文件路径/文件名 目标文件夹路径

4. Copy a folder to another path

sudo cp -r 文件夹路径/文件夹名 目标文件夹路径

Guess you like

Origin blog.csdn.net/weixin_37950717/article/details/125222738