Skip to Content

Renaming multiple files.

MSameer's picture

In the old days, I was using a for loop to rename multiple files.

Today I've discovered a new command: rename(1)

rename is not a traditional UNIX command but it comes with perl, And I guess you'll find a system without perl these days ;)

Imaginr that you have some files with underscores in their names and you want to change the underscores to spaces.
In the old days I used to do:

Now I can do:
Note that s/_/ /g is a perl regular expression "perl regex"
for more information:



Dr. Radut | book