How to rename multiple files on Linux - LinuxConfig.org

Renaming files on Linux systems is usually handled by the mv (move) command. The syntax is just mv old.txt new.txt. Simple enough, but what if we have multiple files that need to be renamed at once, even hundreds of them? The default mv utility can't handle renaming more than one file unless we do a bit of scripting.


This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-rename-multiple-files-on-linux

Hello friends,

i also had the target to rename multiple files and directly add a counter to the filenames. For the result I also published a YouTube video tutorial. Just search for “Linux command line tricks How to rename all files in Ubuntu terminal”

Here is the final command with zmv

count=1 ; zmv '(*).jpg' 'my-new-filename-$((count++)).jpg'