How to Rename a Directory in Linux

Directories in Linux are folders that are used to store and organize the files. You can nest the directories, modify their permissions, create shortcut links to them, and more. Among these many features, you can also modify the name of a directory which is a fundamental task of Linux users. Moreover, it is essential to rename a directory to ensure an easy access and structurize the data.

Users often create temporary directories. But due to obvious reasons, they need to rename them later. However, many of them are unaware of the method that is used for this process. Don’t worry if you’re one of them because this guide will briefly discuss how to rename a directory in Linux.

How to Rename a Directory in Linux

Renaming a directory is easy in Linux. You can do it using a simple “mv” command in the following syntax:

mv [old directory name] [new directory name]

Before using this command, navigate to the parent directory of the targeted directory. Otherwise, the command won’t work. After that, check the contents of that directory using the “ls” command to verify that the targeted directory exists inside it.

For example, as you can see in the previous image, we have a directory named “Temp_Directory”. So, let’s rename it to “Scripts”.

mv Temp_Directory Scripts

The “mv” command does not show anything upon a successful execution. Therefore, use the “ls” command again to verify the changes.

Note: If the renamed directory was initially referenced somewhere, such as in a script or some configuration, update these references accordingly to avoid future errors.


The process of renaming the directories is straightforward. So, this guide briefly explains how to rename a directory in Linux. It starts with navigating to the parent directory, then using the “mv” command to rename the targeted directory, and finally verifying the changes. Furthermore, the users can efficiently rename their directories by following the process to maintain an organized and well-structured file system.


Leave a Comment