How to rename a file in Ubuntu : Ubuntu Beginners
This article is part of a series entitled “Ubuntu Beginners”, which walks new users through basic Desktop and Command Line usage. This article will detail how to rename files, using both the graphical interface as well as the command line. Included below are GNOME, KDE and command line methods.
Rename Files – Nautilus (GNOME)
If you are using the standard Ubuntu, which uses the GNOME Desktop Environment, the file manager is called Nautilus. Anytime you are browsing files or folders graphically, you are using Nautilus. I’ve included screenshots below displaying the default Home folder, selecting a document, and renaming the document.
This is the default Nautilus view in Ubuntu 9.10, displaying the contents of the home folder. You’ll notice that there are pre-populated directories (folders) for Documents, Downloads, Music, Pictures, etc.
In this next screenshot I’ve selected a document in my Documents folder, and selected the ‘Rename…’ option. This is done by selecting the file, right-clicking the mouse and selecting the ‘Rename…’ option.
After selecting the ‘Rename…’ option, the file name will become editable. You can update the text to your preference, and rename your file.
Once you’ve updated the file name simply hit the [ENTER] key on your keyboard, or click your mouse anywhere outside of the editable text area. The edit-field will disappear and your file will have been renamed.
Rename Files – Dolphin (KDE)
If you have installed Kubuntu, the KDE-based Ubuntu variant, your file manager is called Dolphin. I’ve included screenshots of Dolphin, as well as the process of renaming files in Dolphin.
This is the default Home folder as displayed by the Dolphin file manager.
In order to rename a file, simply right-click on the file and select the ‘Rename…’ option. You’ll notice that Dolphin also provides a keyboard shortcut to rename using the F2 key. This means, instead of right-clicking and selecting ‘Rename…’ you can simply press F2 after the file has been selected.
Lastly, enter the new name of the file into the dialog box and update your changes by hitting the [ENTER] key, or clicking the ‘Rename’ button.
Rename Files – Command Line (Linux)
The method of renaming a file on the command-line is generic to Linux. In other words, this method should apply to any Linux distribution, any version, and any variant.
In Linux, renaming a file is essentially the same as moving a file. Where moving a file is simply moving a file from one location to another, renaming a file is essentially moving the name of the file. The contents remain the same, we’ve simply moved the place where you’d find them–from one name to another.
To rename a file, using the following syntax:
mv welcome-to-ubuntu.doc renamed.doc
A few additional examples:
mv IMGOOO1.JPG release-party-pictures-1.jpg mv IMGOOO2.JPG release-party-pictures-2.jpg
You get the idea. I understand it can be confusing to use the mv (move) command to rename a file, but you’ll find that you get used to it rather quickly and then not even think about it.
No matter the environment that you’re in, whether in be GNOME, KDE or the command-line, renaming files is simple. Right-click and select ‘Rename…’ is generally standard between graphical environments, and using
mv on the command-line will work on all Linux distributions. I hope this beginner tip has been helpful.