main logo

How to Rename Files and Directories in CentOS?

install centos

 

In this post we will see how to rename Files and directories using terminal commands in CentOS. CentOS is a Community Enterprise operating system which mainly focuses on the server. It is a part of Linux Operating System Distribution and it is free to use. First open the terminal.

Total Time Needed: 30 Minutes

Required tools:

CentOS

Steps to Rename files and Directories in CentOS

Step 1 : Rename files
To Rename files use the command mv old_file_name new_file_name. For example to rename file1 to file.txt. Type the command mv file1 file.txt and press enter

Step 2 : Check if name is changed
Use the command ls to check if the name is changed. Type ls and press enter. You can see the file name is changed to file.txt.

Step 3 : Rename Directories
To rename Directories, use the command mv. For example, to rename dirc to dirf. Type the command mv dirc dirf and press enter.

Check if name is changed- Use the command ls to check if the name is changed. Type ls and press enter. You can see the directory name is changed to dirf .

Can i rename files and directories Before deleting them in CentOS?

Yes, you can rename files and directories before deleting them in CentOS. This can be done to ensure that you are removing the correct items. However, it’s important to use caution when deleting files and directories in centos to avoid accidentally removing important data.

Conclusion

To rename Files and directories in CentOS you can follow these steps. If you have any doubts please contact Medha Hosting
Read Here: How To Print File Content To The Screen In CentOS?

Rakshitha
Rakshitha
Rakshitha a cloud hosting expert who helps businesses get the most out of their cloud services. She has experience setting up and managing cloud environments to improve performance and scalability. With her cloud certification, Rakshitha provides clear advice on how to use cloud solutions effectively for better business results.
Share
Contents

Related Articles

medhacloud logo
USA:
Medha Cloud Solutions LLC
30 N Gould St Ste R, Sheridan, WY 82801,
Phone: +1 646 775 2855

India:
Medha Cloud Solutions Private Limited
#74, 7th Cross, Krishna Garden InCity Layout. Chikka Kammanahalli, Banneraghatta Road, Bangalore 560083
Phone:+91 93536 44646

E-Mail: sales@medhahosting.com
©Medha Cloud 2024. All rights reserved.