YouTip LogoYouTip

Linux Comm Mv

# Linux mv Command [![Image 3: Linux Command Manual](#) Linux Command Manual](#) The Linux mv (full English name: move file) command is used to rename files or directories, or to move files or directories to another location. ### Syntax mv source dest mv source... directory **Parameter Description**: * **-b**: When the target file or directory exists, a backup will be created before overwriting. * **-i**: If the source directory or file to be moved has the same name as the target directory or file, it will first ask whether to overwrite the old file. Enter y to overwrite directly, or enter n to cancel the operation. * **-f**: If the source directory or file to be moved has the same name as the target directory or file, it will overwrite the old file directly without asking. * **-n**: Do not overwrite any existing files or directories. * **-u**: The move operation is performed only when the source file is newer than the target file or the target file does not exist. mv Parameter Settings and Results | Command Format | Result | | --- | --- | | mv source_file(Files) dest_file(Files) | Rename the source file source_file to the target file dest_file | | mv source_file(Files) dest_directory(directory) | Move the file source_file to the target directory dest_directory | | mv source_directory(directory) dest_directory(directory) | If the directory name dest_directory already exists, move source_directory into the directory named dest_directory; if the directory name dest_directory does not exist, rename source_directory to dest_directory | | mv source_directory(directory) dest_file(Files) | Error | ### Examples Rename file aaa to bbb: mv aaa bbb Place the info directory into the logs directory. Note that if the logs directory does not exist, this command will rename info to logs. mv info/ logs For example, to move all files and directories under **/usr/tutorial** to the current directory, the command is: $ mv /usr/tutorial/* . [![Image 4: Linux Command Manual](#) Linux Command Manual](#)
← Linux Comm OdLinux Comm Mtoolstest β†’