How to Use Unix MV Command to Rename a File

In this tutorial we will show you How to Use the unix mv command. The MV command is used to rename file names and directories. For that you have to go to the terminal application, list the contents of the directory and enter the command which can be used to rename files.
To understand more about unix commands of mv follow the tutorial steps given below.

Step 1 – List directory contents

Let’s look at an example over here. First, we will list the contents of the directory. Over here, you can see that three files are appearing in the desktop.

View the contents of the directory

Step 2 – Enter command to rename file

Now let’s rename the first file, by typing in the unix mv command:
“mv 1 textfile”
Notice here, that one was the filename which has to be renamed and the text file is the new file name we want to keep.

Insert command to rename file

Step 3 – Verify if the file has been renamed

With that done, let’s verify if the changes have been made or not by listing the contents of the directory here.
If you use the “-V” trigger with the MV command, you will get a confirmation message that the file has been renamed.
And that’s it, through the steps given above you can learn how to use the unix command of mv in Linux.

Check if the file has been renamed