How to rename file on CentOS and RHEL 6/7 step by step guide


How to rename file  on CentOS and RHEL 6/7  step by step guide

In this article we will learn how to rename file and multiple files  on linux system which is very common task for a linux administrator and also change the extension of the multiple file in linux system.  

How to rename single file on CentOS and RHEL  linux system

-------------------------------------------------------------------

To rename the file of the linux system we need to execute the below command.

#mv  <oldfile> <newfile>

Lets take an example we have one file names testold and we want to rename this file name to testnew.so we need to execute the below command.

#mv  testold testnew

[root@localhost project]# touch testold
[root@localhost project]# ls
testold
[root@localhost project]# mv testold testnew

After execute the above command we can verify it using ls command.

[root@localhost project]# ls
Testnew
How to rename file  on CentOS and RHEL 6/7  step by step guide
How to rename file  on CentOS and RHEL 6/7  step by step guide

How to rename multiple file on linux system

-------------------------------------------------------------------
To rename multiple files on linux system we need to use rename coammnd.
#rename  's/old/new/' files
Suppose  we have many files with the extension of sh we need to change the extension into txt so we need to execute the below commands.
#rename  's/sh/txt/' *.sh
*  indicates that all files with sh extension will be converted to txt extension.

That’s all. If this article is helpful please share it!!!!




SHARE

Admin

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment