Rename a Directory in Linux: 3 Methods

Different Ways To Rename A Directory In Linux

If you achieve a goal using a different method than the one which society uses, does the method even matter? Well, in the case of Linux-based operating systems, there is usually more than one way through which you can complete a task.

In this article, we will be taking a look at different ways through which we can rename a directory on Linux-based distributions, whether with the GUI-based file manager or directly in the Terminal.

1. Renaming a directory from the Terminal

Although the mv command is used to move files from one location to another, You can also use it to rename a directory or file from the terminal. You are essentially moving a directory to a different ‘location’, that is, under a different name. You can do this by typing the command in the following manner:

mv directory_to_be_renamed New_name

Let’s say I want to rename, ‘Directory’ to ‘Folder’, I will have to type :

mv Directory Folder
Renaming A Directory From The Terminal
Renaming A Directory From The Terminal

2. The GUI Method

Just open your file manager (which could be named Caja, Thunar, Nautilus, Nemo or Dolphin depending on your Desktop Environment), right-click the file or Directory you want to rename, and select the Rename option. You can also press the F2 button on your Keyboard to rename directly.

Renaming A Directory From The File Manager
Renaming A Directory From The File Manager

Just type a new name and press the Enter key on your Keyboard. Note that file managers like Nautilus and Dolphin allows bulk-renaming directories and files, so you can select multiple directories and rename them in a pattern (Like Folder001, Folder002 etc.) very easily. However, I’m using Nemo, the default file manager of Cinnamon Desktop Environment where this feature is not available, so I’m going to use a bulk-rename tool called as GP-Rename.

3. GP-Rename – For Bulk Renaming

You can easily install GPrename on any Linux-based operating system by typing the following command :

#  In Debian and Ubuntu based distribution
sudo apt update && sudo apt install gprename
# In Fedora Workstation
sudo dnf install gprename
# In Arch based distributions
sudo pacman -S gprename
Installing GPRename In Arch Based Distributions
Installing GPRename In Arch-Based Distributions

Its usage is really simple, and it is discussed in detail here.


Well, that’s about it! We have discussed 3 methods through which you can use to rename a directory or files, whether individually or in bulk, with the help of a command line and a file manager.

We hope the concept of renaming directories and files is apparent to you now if you have paid attention to the command line method. Renaming is not different from moving, and when you move a file or directory, you are just changing how the file ‘looks’ to you now, its position on the storage medium does not change.


mv command – Man page