[sujin@localhost blog]$ ls -l
total 0
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos6file1
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos6file2
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos6file3
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos6file4
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos6file5
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:14 centos6file6
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:14 centos6file7
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:14 centos6file8
total 0
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos6file1
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos6file2
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos6file3
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos6file4
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos6file5
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:14 centos6file6
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:14 centos6file7
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:14 centos6file8
From the above list of files i want change all the filename starting with centos6 to centos7. I mean file centos6file2 changed to centos7file2.
It is bit time consuming using mv command to change it one by one. Persong who using mv command for do this not a good linux user.
By using a linux command called rename we can achieve this.
rename centos6 centos7 centos6*
After applying above command file name list would be like below.
[sujin@localhost blog]$ rename centos6 centos7 centos6*
[sujin@localhost blog]$
[sujin@localhost blog]$ ls -l
total 0
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos7file1
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos7file2
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos7file3
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos7file4
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:12 centos7file5
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:14 centos7file6
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:14 centos7file7
-rw-rw-r--. 1 sujin sujin 0 Oct 19 13:14 centos7file8
!!!
Operating System Used : Fedora release 20 (Heisenbug)