To rename multiple files using the command line, you can use the rename command or a shell script. Its syntax is as follows.

$ rename regular_expression files

As you can see, the catch is that you need to know regular expressions. But for simpler tasks, regular expressions are really easy. For example,

$ rename *.htm *.html

This changes the extension of all files from .htm to .html.

$ rename “s/ *//g” *.jpg

This code removes spaces from filenames. Rename functions can be used for more powerful renaming features but the limitation is what you can do with a regular expression. For more powerful features, you need to write a shell script. The following shell script renames all photos in a folder to rockies-100.jpg, rockies-101.jpg, …

i=100
for j in .jpg;
   do mv “$j” “rockies-$i.jpg” ;(( i++ ));
done

A note about shell scripts. Do not add additional space i = 1 is not the same as i=1