How to Rename a Directory in Linux?

Use the `mv` command:

`mv old_directory new_directory`

Rename a directory with an absolute path:

`mv /path/to/old_directory /path/to/new_directory`

Rename a directory with a relative path:

`mv old_directory renamed_directory`

If the target directory name already exists, `mv` will move the source into it instead of renaming it

Use `sudo` if you do not have permission:

`sudo mv old_directory new_directory`

Suggested for You

Trending Today