Command function: move or rename a file or folder name command syntax: mv [-parameter] [source file or directory or target file or directory] parameter:-B or & ndash; if the backup file needs to be overwritten, the backup is overwritten first. -F OR & ndash; force: if the target file or directory is the same as the existing file or directory, the existing file or directory will be overwritten. -I or & ndash; interactiv
Command function:MobileOrRenameFile or folder name
Command syntax: mv [-parameter] [source file or directory or target file or directory]
Parameters:
- -B or-backup if you need to overwrite the file, overwrite the original backup.
- -F or-force: if the target file or directory is the same as the existing file or directory, the existing file or directory will be overwritten.
- Ask the user before-I or-interactive overwriting.
- -S <附加字尾> Or
- -Suffix = <附加字尾> Used with the-B parameter to specify the end of the backup file.
- -U or-update when moving or changing the file name, if the target file already exists and its file date is newer than the source file, the target file is not overwritten.
- -V or-verbose displays detailed information during execution.
- -V = <方法> Or
- -Version-control = <方法> Used together with the-B parameter, you can specify the backup method.
- -Help: displays help.
- -Version: displays the version information.
Example:
- Move the file to a directory
Mv hello test/hello, command to move the hello file to the test folder
-
Rename a file
Change file name hello to world
-
Display execution information during execution
-
The following parameter example is related to the application scenario that "if a file is moved to a certain place and a file with the same name exists somewhere", which is mainly about how to deal with overwriting the file. First, create a file "hello" under the "test" file with the content "hello world2", and then move the "hello" file in the current folder to the "test" folder. this creates an application scenario.
- -B parameter, backup during overwriting
We can see that the overwritten file hello backs up a file hello ~, Before overwriting, I asked the user
The-f and-I parameters are not introduced because the user is asked by default and the backup is not performed.