Use the mv command to rename a file or directory or move the file from one directory to another. This command is equivalent to the combination of The ren and move commands in the DOS system. The permission is granted to all users. Format: mv [options] source file or directory target file or main parameter [options]-I: interactive operation. If the mv operation will overwrite the existing target file, the system will ask whether to rewrite the file and ask the user to answer "y" or "n" to avoid overwriting the file by mistake. -F: disable interactive operations. Mv operation required
Function
Mv command to rename a file or directory or move the file from one directory to another directory. This command is equivalent to the combination of The ren and move commands in the DOS system. The permission is granted to all users.
Format
Mv [options] source file or directory target file or directory
Main parameter [options]
-I: interactive operation. If the mv operation will overwrite the existing target file, the system will ask whether to rewrite the file and ask the user to answer "y" or "n" to avoid overwriting the file by mistake.
-F: disable interactive operations. When an mv operation overwrites an existing target file, no indication is given. If this parameter is specified, the I parameter will no longer work.
Select Parameters
When the parameter type is set to file, the mv command renames the file and renames the given source file or directory to the specified target file name.
When the selected parameter is an existing directory name, there can be multiple source files or directory parameters. the mv command moves the source files specified by each parameter to the target directory. When a file is moved across file systems, the mv copies the file first, and then deletes the original file. the link to the file will also be lost.
Application instance
(1) Move all files in/usr/udt to the current directory (represented:
$ Mv/usr/udt /*.
(2xx) rename the file test.txtto wbk.txt:
$ Mv test.txt wbk.txt