Move (Rename) -mv

This Linux command line command will either rename or move a file. People that are new to Linux don't realize that the MV command is also known as the rename command.

MV Options:

--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 equivalent to --reply=yes
-i, --interactive
prompt before overwrite equivalent to --reply=query
--reply={yes,no,query}
specify how to handle the prompt about an existing destination file
--strip-trailing-slashes remove any trailing slashes from each SOURCE
argument
-S, --suffix=SUFFIX
override the usual backup suffix
--target-directory=DIRECTORY
move all SOURCE arguments into DIRECTORY
-u, --update
move only when the SOURCE file is newer than the destination file or when the destination file is missing
-v, --verbose
explain what is being done
--help
display this help and exit
--version
output version information and exit

To rename a file while in current directory

mv file.txt file2.txt

To move a file from current directory to another and keep the original name

mv file.txt /path/to/directory/
 
linux_administration/common_linux_commands/move.txt · Last modified: 2007/09/14 15:42 by vincenzobar
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki