Syntax
Mv [options] source destmv [options] source... directory
Parameter description:
-I: if the specified directory already contains files of the same name, first ask whether to overwrite the old file;
-F: Do not give any instructions when the mv operation needs to overwrite an existing target file;
Mv parameter settings and running results
| Command format |
Running result |
| Mv file name |
Change the source file name to the target file name. |
| Mv file name directory name |
Move the file to the target Directory |
| Mv directory name |
The target directory already exists. Move to the target directory; target If the directory does not exist, rename it. |
| Mv directory name file name |
Error |
Instance
Rename the file aaa to bbb:
Mv aaa bbb
Put the info directory into the logs directory. Note: If the logs directory does not exist, this command will rename info to logs.
Mv info/logs
Another example is to move all the files and directories under/usr/student to the current directory. The Command behavior is as follows:
$ Mv/usr/student /*.