How to rename Files and Directories in CentOS

How to rename Files and Directories in CentOS

By: ZebraHost

Using the mv you can rename files or entire directories in CentOS.

Command: mv "original name" "new name"

Here is an example of a file being renamed in CentOS:

Below is a list of files within the “files” directory in my system. I want to rename “testfolder” to “important

image

To rename “testfolder” type, mv testfolder important in the terminal.

image

As you can see above, “testfolder” was succesfully changed to “important

Here is an example of the same command working with a file as well:

file” was changed to “thebestfile

image

The “mv” command is universal across all Linux systems and will work with popular distros such as Ubuntu, Debian, etc.