Common options:
- b If you need to overwrite the file, back up the file that will be overwritten before overwriting
- F forced Override
- I. if the directory file or directory exists, it will prompt for overwrite, enter y overwrite, n cancel overwrite
- u if the directory file or directory exists, it will overwrite if the source file or directory is relatively new
- T Specifies the target directory for MV, which is suitable for moving multiple files to the same directory at the same time, where the target directory is in front, and the source file or directory is behind
Common examples:
Example one: Renaming the file file.txt and directory dir to File.log and Dir1 respectively
command: MV file.txt file.log--file renamed
mv dir dir1--directory renaming
Example two: Move the file Test.txt to the directory/usr/
Command: MV test.txt/usr/
Example three: Moving files file1, file2, file3 to the/usr/directory
Command: mv file1 file2 file3/usr/or mv-t/usr/file1 file2 file 3
Example four: When the target location is the same as the source file name, such as the source file name File1, and to move the file1 under the root, but there is also a file named File1 under the root, forcibly overwrite
Command: MV -F File1/file1
Example five: condition and example four, just require the file1 of the directory location to do a simple backup before overwriting
Command: MV -B file1/file1
Note: A simple backup made before overwriting, the generated simple backup file name is file~, but the same file can only be backed up once, once again need to overwrite, the simple backup will also be overwritten