This guide explains how to rename file on Linux using the mv command.
Let us follow the steps:
- If you want to rename a file, you can run the below command-
mv oldnamefile1 newnamefile1 - Let us assume that you are located in the directory, there is a file named fileA.txt, and you wish to change the name to fileB.txt. Execute the following command-
mv fileA.txt fileB.txt - If you are not in the directory, you can execute the below command-
cd /home/user/docs/files
mv fileA.txt fileB.txt
That is it! Hope you liked our KB. If you have any doubt, please do not hesitate to get in touch with our support staff.