We introduce three related commands
Order | Corresponding to English | effect |
tree[directory name] | tree | List the file directory structure in a tree diagram |
cp source file object file | copy | Copy files or directories |
mv source file object file | move | Move file or directory/rename file or directory |
1.tree
The tree command can list the file directory structure in a tree diagram
Option -d means to display only the directory
2.cp
The function of the cp command is to copy the given file or directory to another file or directory, which is equivalent to the copy command under DOS
Options | meaning |
-f | The existing target file is directly overwritten without prompting |
-i | Tips before overwriting files |
-r | If the given source file is a directory file, then cp Will recursively copy all subdirectories and files under the directory, the target file must be a directory name |
When copying, you can use . to indicate the current path. If a new file name is specified, the name will be updated. If only . is not specified, it will be copied to the current directory and the file name will remain unchanged.
Use -i to prompt whether to overwrite a file with the same name
When copying a folder with cp, you must use the -r option, such as
3.mv
The mv command can move files or directories, and can also rename files or directories
-i option prompts before overwriting files
Moved the 1b.txt file from aaa to the c1 folder
Rename 123 (duplicate) to 123