每天一个Linux命令(6):mv命令
mvmv [选项] 源文件 目标文件1.
mv file1.txt file2.txt这将将 file1.txt 移动到 file2.txt,相当于对文件进行重命名。
2.
mv file.txt directory/3.
mv oldname.txt newname.txtmv sourcedir/ destination/mv -i file.txt destination/mv -v file.txt destination/[[email protected] /]# mv --helpUsage: mv [OPTION]... [-T] SOURCE DESTor: mv [OPTION]... SOURCE... DIRECTORYor: mv [OPTION]... -t DIRECTORY SOURCE...Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.Mandatory arguments to long options are mandatory for short options too.--backup[=CONTROL] make a backup of each existing destination file-b like --backup but does not accept an argument-f, --force do not prompt before overwriting-i, --interactive prompt before overwrite-n, --no-clobber do not overwrite an existing fileIf you specify more than one of -i, -f, -n, only the final one takes effect.--strip-trailing-slashes remove any trailing slashes from each SOURCEargument-S, --suffix=SUFFIX override the usual backup suffix-t, --target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY-T, --no-target-directory treat DEST as a normal file-u, --update move only when the SOURCE file is newerthan the destination file or when thedestination file is missing-v, --verbose explain what is being done-Z, --context set SELinux security context of destinationfile to default type--help display this help and exit--version output version information and exitThe backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.The version control method may be selected via the --backup option or throughthe VERSION_CONTROL environment variable. Here are the values:none, off never make backups (even if --backup is given)numbered, t make numbered backupsexisting, nil numbered if numbered backups exist, simple otherwisesimple, never always make simple backupsGNU coreutils online help: <https://www.gnu.org/software/coreutils/>Full documentation <https://www.gnu.org/software/coreutils/mv>or available locally via: info '(coreutils) mv invocation'