Most Linux distros come with a command line utility called rename pre-installed, which, as the name implies, can rename multiple files at once. This tool is actually a Perl script, and takes as an argument a regular-expression based renaming rule, which changes all file names that are matched with the rule. The usage of rename is as follows.
rename [-vnf] <regular_expression> <files>
With "-n" option, rename will show what files would be renamed, without actually changing file names. This option is useful when you want to test a renaming rule beforehand.
To change the extension of all files from .JPEG to .jpg:
To convert all uppercase letters including extensions to lowercase counterparts:
To strip the extension of all files matching "*.bak":
Check the other tutorial for more use cases of rename command.
Subscribe to Ask Xmodulo
Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!