Linux users can easily rename files with the mv command. However, the problem arises when you have multiple file names that you want to rename. Changing the name of each file one at a time can be a frustrating task for anyone.
Fortunately, there are several ways to batch rename files on Linux. We'll discuss the simplest and most effective methods for doing the same in the following sections.
Batch renaming of files on Linux
The Linux operating system mainly depends on packages and commands. And, obviously, there are several commands available that a user can use to rename files on a Linux computer en masse.
1. Using the Ubuntu Rename command
Ubuntu and other Debian-based distributions come with a userspace program called rename This enables the batch renaming of files on Linux. This utility is part of the util-linux Package and is referred to as rename.ul. It helps a user to batch rename files through simple replacements.
The below command will rename five image files using the Linux terminal. We have already created the files on our test system. Make sure to run this command with caution as it may rename other files that may exist in your working directory.
Photos of the rename.ul * .png file
This command renames the picture file1.png to photos1.png etc. for all other files in the current working directory.
How 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 The utility is a Perl-based program that makes it easier to rename batches through the expanded use of regular expressions. You can use robust pattern matching techniques to rename multiple files at once. You can install it on your preferred Linux distribution using your system's standard package manager.
To install the package on Debian-based distributions like Ubuntu:
rename sudo apt install
On Arch Linux:
sudo pacman -S perl-rename
To install rename on CentOS and Fedora:
sudo yum install prename
Now that you've installed the package, it's time to bulk rename files on Linux. The following command replaces the occurrence of file in the filename too photo.
rename & # 39; s / file / photos / & # 39; * around
Use the following command to change lowercase filenames to uppercase. Toggle the substitution pattern for conversion to lower case.
Rename & # 39; y / a-z / A-Z / & # 39; * # in capital letters
Rename & # 39; y / A-Z / a-z / & # 39; * # around and convert to lowercase
3. Batch renaming files on Linux with qmv
Qmv or the fast movement Command contained in the rename The package makes it easy for Linux administrators to rename bulk. You can rename files and directories using your favorite Linux text editor. Make sure you have that installed rename Package before trying to rename files with qmv.
You can install the package using one of the following commands.
sudo apt install renameutils # install on Debian based distributions
sudo pacman -Syu renameutils # on Arch Linux
sudo yum install renameutils # on Fedora and CentOS
You can rename files on Linux using bulk qmv once rename was installed. Navigate to and go to the directory that contains the files qmv from the terminal.
It will open the filenames in your text editor. There are two columns, one for the original filename and one for the new name. You can rename Linux files in bulk by editing the second column. The following screenshot shows the process with the Vim text editor.
4. Bulk renaming of Linux files with Vimv
Vimv is a stand-alone program that provides Vim users with the ability to rename batches. If you're not a fan of the Vim text editor, you can easily change the default editor by adjusting the environment variable $ EDITOR.
Before doing that, however, you'll need to download a copy of the Vimv package using Git.
Git clone https://github.com/thameera/vimv.git
Copy the binary into your $ PATH and change the file's permissions to make it executable. Enter the following commands one at a time from your terminal.
sudo cp vimv / vimv / usr / local / bin /
sudo chmod + x / usr / local / bin / vimv
You can now rename files en masse with Vim. Write the vimv Command in the console to start the program.
You will get a single column with the filenames. Change the filenames to your liking and save and exit Vim.
5. Batch renaming of Linux files with Emacs
Emacs text editor users can easily rename multiple files. A major advantage of this method is that you don't have to install separate packages or plugins. Just follow the steps given below to rename your files using Emacs.
Start the Emacs Editor on your system.
Press Alt + X. switch on the keyboard command Mode. Then enter the following command to enter the desired or "Writable Directory Editor Mode".
Enter the path to the directory that contains your batch files and press the key Enter Key.
Press Ctrl + X. followed by Ctrl + Q. to switch to read / write mode.
Emacs will show you a prompt with all the files in the source directory. Change the names to your preferred ones and press Ctrl + C. twice to save the changes.
6. Rename multiple files with 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 is not already installed. Use one of the following commands based on your distribution.
sudo apt-get install thunar # on Debian-based distributions
sudo yum install thunar # on Fedora and CentOS
sudo pacman -S thunar # on Arch
After installing Thunar, call up the Bulk Renamer dialog via the file manager itself. Use the following command when you just need the rename tool.
The system opens a new window in which you can select the source files and rename them accordingly. This bulk renaming utility allows you to rename both the file name and the file suffix.
7. Bulk renaming of files with Smart File Renamer
Smart File Renamer is a GUI app that makes it easy for Linux beginners to rename bulk. It is available as a snap package for systems that support it. You can install Smart File Renamer by running the snap command below.
sudo snap install smart-file-renamer
Once installed, open the app by searching for it in the application area. You will be greeted with an intuitive user interface that makes navigation self-explanatory.
In this window, add the files or directories that you want to rename. You can now rename Linux files in bulk using multiple filters and rules.
Rename multiple files at once on Linux
As you can see, it is not very difficult to batch rename files in Linux distributions. We've gathered several useful methods that can help with this task. You can rename your files right from the command line, or you can opt for a graphical solution. The options are there, so all you have to do is choose.
If you're using Windows or macOS and want to rename image files in bulk, Adobe Bridge might be a useful tool. You can also use Adobe Bridge to manage your digital assets and files.
Batch rename your photos with Adobe Bridge
Don't overlook the batch file processing capabilities of Adobe Bridge. Try this tip to rename all of your pictures at once.
About the author
(13 articles published)
Rubaiat is a CS graduate with a strong passion for open source. As well as being a Unix veteran, he's also been into network security, cryptography, and functional programming. He is an avid collector of used books and has an endless admiration for classic rock.
By Rubaiat Hossain
Subscribe to our newsletter
Sign up for our newsletter to receive tech tips, reviews, free e-books, and exclusive offers!
One more step …!
Please confirm your email address in the email we just sent you.