rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY. if DEST is an existing file, rename the source file. If DEST is an existing directory, move source(s) to DIRECTORY. Note that you are not allowed to move a directory to a file.
Option
Description
-f, –force
do not prompt before overwriting. Be careful when using this option
-i, –interactive
prompt before overwrite
-n, –no-clobber
do not override existing file
-v, –verbose
explain what is being done
Example
Rename/move a file/directory
1
mv -v path/to/oldFileName path/to/newFileName
Override without prompt
1
mv -f file.txt file1.txt
Prompt before overriding
1
mv -vi file.txt file1.txt
Move Multiple files to a directory and show details
1
mv -v file1.txt file2.txt file3.txt dir
Move everything in a directory to another location
1
mv -v dir/* .
Rename a directory
if dir2 does exist, then dir1 will be renamed to dir2, otherwise dir1 will be moved under dir2