How to Rename a Directory in Linux [3 Easy Methods]

Rename a Directory in Linux

Renaming directories in Linux systems is one of the basic operations every user performs. To rename a file or directories, you need to use the “mv” command from the terminal. Alternatively, you can rename by right-clicking the file or directories. In this tutorial, I am going to explain how to rename a directory in Linux operating systems using the command line. So let’s get started.

How to Rename a Directory in Linux

  1. Rename directories using mv command.
  2. Rename directories using find command.
  3. Rename directories using rename command.

Let’s discuss all the method one by one

Rename directories using mv command

You can use mv command to rename a directory in Linux. For example, if you want to rename the directory “Linux” to “Linux_LTS”, run the following command to perform the operation.

$ sudo mv Linux Linux_LTS

*If you are not root user, you have use sudo.

If you want to rename a directory from a different location. Let’s consider you are renaming the directory from the apache document root and you are running the command on home directory. In that case, you have to use full path from the root (absolute path) in the command to rename directory.

$ sudo mv /var/www/html/example_directory /var/www/html/example_directory_renamed

Rename Directories using Find Command.

Sometimes we need to use find command to locate the directory to perform some sort of operations. You can use find command to rename a folder in Linux. For example,

$ find . -depth -type d -name Linux -execdir mv {} Linux_1 \;

The above will first find the directory “Linux” and then rename it to “Linux_1” using mv command.

Rename Directories using Rename Command.

Apart from mv command, you can use rename command to rename your files and directories.

$ rename Linux_1 Linux_2
rename a directory in Linux

By default, the rename command not installed in your Linux system. To use rename command first you have to install using apt.

$ sudo apt install rename

Now, you can rename any directories using rename command.

You can also check out How to Copy Files and Directories in Linux


In this article, you have learned how to rename a directory in Linux operating systems. If you have any doubts feel free to contact me, I will definitely try to help you. Also, you can join our elite Facebook group to get direct help from me. If you like this tutorial, please share this article on your social media handle.


Please enter your comment!
Please enter your name here