Home » Linux mv | Linux Move File

Linux mv | Linux Move File

by Online Tutorials Library

Linux mv | Linux Move File

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.


How To Rename a File

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

Linux File mv command 1

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

How To Rename a Directory

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

Linux File mv command 2

mv Option

Option Function
mv -i Asks for permission to over write.
mv * Move multiple files to a specific directory.
mv –suffix Used to take backup before over writing.
mv -u Only move those files that doesn’t exist.
Next TopicLinux rename

You may also like