The mv
command is a powerful tool that can be used to move or rename files and directories in Linux. In this blog post, we will show you how to use the mv
command to rename a folder in Ubuntu.
Steps
- Open a terminal window.
- Navigate to the directory that contains the folder you want to rename.
- Type the following command:
mv old_folder_name new_folder_name
For example, to rename a folder named old_folder
to new_folder
, you would type the following command:
mv old_folder new_folder
- Press Enter.
The folder will be renamed to the new name.
Tips
- You can use spaces in folder names, but you must enclose the name in quotes. For example, to rename a folder named
My Documents
toMy "Important" Documents
, you would type the following command:
mv "My Documents" "My \"Important\" Documents"
- You can use the
-T
option with themv
command to prevent the rename from happening if the new folder name already exists. For example, to rename a folder namedold_folder
tonew_folder
only if the new folder name does not already exist, you would type the following command:
mv -T old_folder new_folder
Conclusion
Renaming a folder in Ubuntu using the command line is a simple process. By following the steps in this blog post, you can easily rename any folder on your system.