The mv command can be used in Ubuntu to rename files. Files and folders can be moved or renamed with the mv command, which stands for move.
Renaming a file can be done using the syntax shown below:
mv old-filename new-filename
Make sure you are in the current directory where the file is present before running the above command. You can navigate to the directory via cd /your-path-where-file is present.
For instance, you would issue the command below to rename a file named “your-old-file.txt.txt” to “your-new-file.txt”:
mv your-old-file.txt your-new-file.txt
Using the mv command, you can also move a file to a different directory by supplying the new name and the target path.
mv /path/to/your-old-file.txt /path/to/new-destination/your-new-file.txt
The mv command will replace any existing files with the same name as the new file name, so use caution while using it.