The MV command is an abbreviation of move, which can be used to move files or rename files, and is a common command used in Linux systems, often to back up files or directories.
1. Command format:
MV [option] source file or directory destination file or directory
2. Command function:
Depending on the second parameter type in the MV command (either the destination file or the destination directory), the MV command renames the file or moves it to a new directory. When the second parameter type is a file, the MV command completes the file rename, at which point the source file can only have one (or the source directory name), which renames the given source file or directory to the specified destination file name. When the second parameter is a directory name that already exists, the source file or directory parameter can have more than one, and the MV command moves the source files specified by each parameter to the destination directory.
3. Common parameters:
-B: Overwrite the previous backup if you need to overwrite the file.
-f:force mandatory Meaning, if the target file already exists, will not be asked and directly covered;
-I: If the target file (destination) already exists, you will be asked to overwrite it!
-U: If the target file already exists and source is newer, update (update)
4. Command instance:
Example one: Renaming a file
Rename the file Zhidao.txt to Baidu.txt
MV Zhidao.txt Baidu.txt
Example two: Moving files
Move the file log1.txt,log2.txt,log3.txt to the directory test3.
MV Log1.txt Log2.txt Log3.txt test3
Linux file (clip) move, rename action command