×


How to rename a directory in Linux using the CLI?

Do you need to rename a directory in Linux using the command line options?

This guide is for you.

Renaming a directory in Linux is very important for different reasons. You can rename a directory in Linux bash shell using the mv command to rename and move files and directories or folders. Everything is a file under Linux operating system including folders.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Linux related tasks.
In this context, you shall learn how to rename a directory in Linux.

How to rename a directory in Linux?

In order to rename a directory in Linux is as follows:
i. Log into your Server via an SSH tool such as putty.
ii. Execute the following Linux command to rename “old_name” folder to "new_name":

mv old_name new_name

You can use full path too:

mv /home/user/old-folder-name /home/user/new-folder-name


[Need urgent support in performing Linux Software Installations? We are available to help you today.]


Conclusion

This article will guide you on the process to rename a directory in Linux using the mv command.