Copyright Notice Update:2017-05-12
Bo Master: Luckyalan
Contact: [Email protected]
Statement: Draft not forget to dig well man, reproduced please indicate the source!
1 Article Introduction
This article describes the MV command below Linux.
2. Development platform
Linux Systems
3. Reading instructions
No
4 Article body
MV (move) is a command that moves a single or multiple files or directories in a UNIX-like operating system. Normally after a move operation, the original file or directory cannot be accessed again. The file name after the move can be the same as the original (as long as it is not in the same directory as the original file), or it can be different. When the files that need to be moved and the new files are on the same file system, the MV command simply renames the original file to achieve a moving effect. The operation requires write access to the directory that needs to be modified.
When the file is moved, the destination file will be deleted if the destination directory contains a file with the same name as the original file. If the existing target file does not have write permission, but its directory has write permissions, the MV command asks the user to confirm the action (when the MV is executed in the terminal) before moving. However, when moving using the-f (Force) option, the MV command skips the user confirmation link and executes the move directly.
In summary, the MV command is used to move or rename files.
4.1 Commands
4.1.1 Command
Command format: MV [option] source file or directory destination file or directory
Command function: Move or rename a file (or directory)
4.1.2 Parameters
Common parameters are as follows:
- -B: If you need to overwrite the file, back up before overwriting.
- -f/--force:force, the meaning of coercion. If the target file already exists, it will not be queried and overwritten directly.
- -I: If the target file already exists, you will be asked to overwrite it.
- -N: Do not overwrite existing files
- -U: If the target file already exists and the source file is newer.
- -T: Specifies the target directory for the MV. This option is useful when moving multiple source files to a directory, when the destination directory is in front of the source file.
4.2 Command Instances
"Not to be Continued"
5 References
1, the concept of this part of the reference to Wikipedia.
2, this article to a large extent refer to the "one Linux command per day (7): MV Command"
Linux command Learning (8): MV command