Linux users can easily rename files using the mv command. However, the problem arises when you have multiple filenames that you want to rename. Changing the name of every file one by one can be a frustrating task for anyone.

Luckily, there are several ways to batch rename files in Linux. We'll discuss the simplest and the most effective methods of doing the same in the subsequent sections.

How to Batch Rename Files in Linux

The Linux operating system depends primarily on packages and commands. And as obvious, several commands are available that allow a user to mass rename files on a Linux machine.

1. Using the Ubuntu Rename Command

Ubuntu and other Debian-based distros ship with a userspace program called rename that allows the batch renaming of files in Linux. This utility is a part of the util-linux package and is referred to as rename.ul. It helps a user in batch renaming files using simple substitutions.

The below-mentioned command renames five image files using the Linux terminal. We've already created the files on our test system. Make sure to run this command with caution since it may rename other files present in your working directory.

        rename.ul file photos *.png
    

This command renames the image file1.png to photos1.png and so on for all the other files present in the current working directory.

rename batch files using Ubuntu rename utility

To change the extensions of the images from png to jpg:

        rename.ul png jpg *.png
    

2. Rename Using the Perl Rename Utility

The rename utility is a Perl-based program that makes batch renaming simple through its advanced use of regular expressions. You can apply robust pattern matching techniques in order to rename multiple files at once. You can install it on your favorite Linux distro using your system's default package manager.

To install the package on Debian-based distributions such as Ubuntu:

        sudo apt install rename
    

On Arch Linux:

        sudo pacman -S perl-rename
    

To install rename on CentOS and Fedora:

        sudo yum install prename
    

Now that you have installed the package, it is time to bulk rename files on Linux. The following command replaces the occurrence of file in the filename to photo.

        rename 's/file/photos/' *
    

Use the following command for changing lowercase filenames to uppercase. Switch the substitution pattern for converting to lowercase.

        rename 'y/a-z/A-Z/' *        # converts to uppercase
rename 'y/A-Z/a-z/' * # converts to lowercase
rename bulk files in Linux using Perl rename

3. Batch Rename Files in Linux With qmv

Qmv or the quick move command, included in the renameutils package makes bulk renaming easier for Linux admins. It allows you to rename files and directories using your favorite Linux text editor. Make sure that you have installed the renameutils package before trying to rename files using qmv.

You can install the package using one of the commands given below.

        sudo apt install renameutils      # on Debian-based distros
sudo pacman -Syu renameutils # on Arch Linux
sudo yum install renameutils # on Fedora and CentOS

You can bulk rename files in Linux using qmv once renameutils has been installed. Navigate to the directory that contains the files and invoke qmv from the terminal.

        qmv
    

It will open the filenames in your text editor. There will be two columns, one for the original filename and the other for the new name. You can bulk rename Linux files by editing the second column. The following screenshot illustrates the process using the Vim text editor.

batch rename Linux files using qmv

4. Bulk Rename Linux Files Using Vimv

Vimv is a standalone program that offers batch renaming functionalities to Vim users. If you are not a fan of the Vim text editor, you can easily change the default editor by tweaking the environment variable $EDITOR.

But before all that, you will have to download a copy of the Vimv package using Git.

        git clone https://github.com/thameera/vimv.git
    

Copy the binary file to your $PATH and change the permissions of the file so it is executable. Enter the following commands one by one to do this from your terminal.

        sudo cp vimv/vimv /usr/local/bin/
sudo chmod +x /usr/local/bin/vimv

You can now mass rename files using Vim. Type the vimv command in the console to start the program.

        vimv
    

You will be presented with a single column containing the filenames. Change the filenames however you see fit and then save and quit Vim.

batch renaming Linux files using vimv

5. Batch Rename Linux Files With Emacs

Users of the Emacs text editor can easily rename multiple files. One considerable advantage of this method is that you don't need to install any separate packages or plugins. Just follow the below-given steps to rename your files with Emacs.

  1. Launch the Emacs Editor on your system.
  2. Press Alt + X on the keyboard to switch to command mode. Then, type the below command to invoke wdired or "writable directory editor mode".
            dired
        
  3. Enter the path to the directory containing your batch files and press the Enter key.
  4. Press Ctrl + X followed by Ctrl + Q to switch to the read-write mode.

Emacs will present you with a prompt showing all the files in the source directory. Change the names to your preferred ones and press Ctrl + C two times to save the changes.

renaming multiple files using emacs

6. Rename Multiple Files Using Thunar File Manager

Thunar is one of the best file managers for Linux with built-in support for bulk renaming. You can install Thunar on your system if it's not installed already. Use one of the following commands based on your distribution.

        sudo apt-get install thunar        # on Debian-based distros
sudo yum install thunar # on Fedora and CentOS
sudo pacman -S thunar # on Arch

Once you've installed Thunar, invoke the bulk renamer dialog from the file manager itself. Use the following command if you only need the renamer tool.

        thunar -B
    

The system will launch a new window where you can select the source files and rename them as appropriate. You can rename the file name as well as the file suffix with this bulk renamer utility.

batch rename Linux files using Thunar

7. Bulk Rename Files Using Smart File Renamer

Smart File Renamer is a GUI app that makes bulk renaming simpler for Linux beginners. It is available as a snap package for systems that support it. You can install Smart File Renamer by issuing the following snap command.

        sudo snap install smart-file-renamer
    

Once it has been installed, open the app by searching for it in the applications panel. You will be greeted with an intuitive user interface that makes navigation self-explanatory.

rename multiple files using smart file renamer

Add the files or directories that you want to rename from this window. You can now bulk rename Linux files using several filters and rules.

Renaming Multiple Files at Once in Linux

As you can see, it's not very hard to batch rename files in Linux distributions. We have compiled several useful methods that can aid in this task. You can choose to rename your files directly from the command-line or opt for a graphical solution. The options are there, so all you need to do is choose.

If you are using Windows or macOS and want to rename image files in bulk, Adobe Bridge might be a useful tool. You can also manage your digital assets and files using Adobe Bridge.