Javatpoint Logo
Javatpoint Logo

mv Command in Linux/Unix with Examples

Linux mv command is used to move existing file or directory from one location to another. It is also used to rename a file or directory. If you want to rename a single directory or file then 'mv' option will be better to use.

Move a File

While moving a file the inode number of both the files will remain the same.

Linux File mv command 1

In the above example, we have moved file 'docc' into 'document'. But inode number of both the files remains the same.

Move a Directory

Directories can be moved in the same way as the files. In this case also inode number will remain the same.

Linux File mv command 2

mv Option

OptionFunction
mv -iAsks for permission to over write.
mv *Move multiple files to a specific directory.
mv --suffixUsed to take backup before over writing.
mv -uOnly move those files that doesn't exist.
Next TopicLinux rename





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA