“mv” command is used to moves a group of file to a another/different directory.
“mv” command can also use to rename file and directory.
This command does not create a new copy of file , it only rename it.
When we rename it does not consume any additional space on the disk.
$ mv file01 RenameFile [press enter]
Example of mv command in Linux and Unix
Rename File using mv command
Suppose we want to rename a file Mybook01 to MyNotes01 than command is as follows:
$ mv Mybook01 MyNotes01 [press enter]
Rename Directory using mv command
Suppose we want to rename a directory dir01 to Mydir01 than command is as follows:
$ mv dir01 Mydir01 [press enter]
Move Number Of Files To a Directory using mv command
Suppose we want to move three files Mybook01 , MyBook02 & MyBook03 into a directory dir01 than command is as follows:
$ mv Mybook01 Mybook02 Mybook03 dir01 [press enter]
Above command moves three files Mybook01 , MyBook02 & MyBook03 into a directory dir01.
Linux Unix mv -i command
-i, –interactive option is used for interactive mode. It Prompts before override a file
Linux Unix mv -n command
-n , –no-clobber don’t override the file while moving
Linux Unix mv -f command
-f, –force option do not prompt before override
Linux Unix mv -t command
-t , –target-directort=DIRECTORY option moves all to directory
Linux Unix mv -v command
-v –verbose explains what is being done