“mv” (move files) command is typically used in order to rename a single file in Linux/Ubuntu.
Sometimes, a user might have a requirement to rename the file in bulk. There are several command line utilities and graphical programs available for renaming files in bulk. This article will demonstrate the detailed process of renaming files in bulk on Linux/Ubuntu 22.04 LTS using the following methods:
- Perl Rename Utility
- QMV
- MMV
- Thunar File Manager
- Ubuntus Default File Manager
How to Bulk Rename Files With Perl Rename Utility?
Rename utility assists a user in renaming files in bulk. It is not pre-installed, however, it can be installed when needed. Before installing the rename utility, let’s first, update the System repositories by executing the following command:
Now run the below-stated command to install Rename Utility:
From the above image, it can be seen that the rename utility is successfully installed. Now, it’s time to bulk rename files via Rename Utility.
The following command replaces the occurrence of “report” in the file name to “file”:
From the below image, it can be verified that the files are renamed from report1.txt, report2.txt, report3.txt, report4.txt, and report5.txt to file1.txt, file2.txt, file3.txt file4.txt, and file5.txt.
Additionally, the name of the files can be converted to uppercase and lowercase via Rename Utility by the commands below:
From the below image, it can be seen that files are successfully renamed from lower case to upper case and from upper case to lower case respectively.
How to Bulk Rename Files With QMV?
QMV (Quick Move) command allows to renaming of files and directories with ease using an editor. QMV is part of the “renameutil” package, which is not pre-installed in Ubuntu. Therefore in order to use qmv, the “renameutils” package is installed by running the following command:
From the above image, it can be seen that renameutils package is installed successfully.
To rename the files in bulk, a user needs to navigate to the directory that contains the files to be renamed and then execute the qvm command:
The default editor is launched after qvm command is executed. There will be two columns. The left-hand side column contains the name of the files, while the right-hand side column can be edited to rename files in bulk.
The file can be saved by pressing Ctrl+X after the files are renamed.
The bulk renaming process can be verified by the “ls” command:
From the above image, it can be verified that the files are renamed from file1.txt, file2.txt, file3.txt file4.txt, and file5.txt to report1.txt, report2.txt, report3.txt, report4.txt, and report5.txt.
How to Bulk Rename Files With MMV?
Mmv utility allows to renaming of files in bulk. It does not come pre-installed in Ubuntu and can be installed using the below-stated command:
From the below image, it can be seen that mmv utility is installed successfully.
The following command replaces the occurrence of “report” in the file name with “file”:
From the below image, it can be verified that the files are renamed from report1.txt, report2.txt, report3.txt, report4.txt, and report5.txt to file1.txt, file2.txt, file3.txt file4.txt, and file5.txt.
How to Bulk Rename Files With Thunar File Manager?
Thunar File Manager is a File Manager for Linux that contains a built-in rename operation. It is not pre-installed in Ubuntu and can be installed using the apt package as follows:
From the above image, it can be seen that Thunar File Manager is installed successfully.
It can be launched using the below-stated command:
The files that are to be renamed can be selected by using the “+” sign. This will re-direct to the directory:
The files that are to be renamed in bulk are selected. The files will be loaded in the Thunar File Manager where there are several options for bulk-renaming like renaming by date, upper case, lower case, search and replace, numbering, etc:
For example, if files are to be named from file1.txt, file2.txt, file3.txt file4.txt, and file5.txt to report1.txt, report2.txt, report3.txt, report4.txt, and report5.txt, the search and replace option can be used to replace all the occurrences of file with the report and by pressing “Rename” button:
We can verify if the files are remanded by running the “ls” command:
From the above image, it can be verified that the files are renamed from file1.txt, file2.txt, file3.txt file4.txt, and file5.txt to report1.txt, report2.txt, report3.txt, report4.txt, and report5.tx.
How to Bulk Rename Files with Ubuntu’s Default File Manager?
Bulk renaming is performed by Ubuntu’s default file manager by selecting the files with the mouse or keyboard and by selecting the “Rename” option from the dropdown.
This will open a new window. For example, if files are to be renamed by bulk from “file1.txt”, “file2.txt”, “file3.txt”, “file4.txt”, and “file5.txt” to “report1.txt”, “report2.txt”, “report3.txt”, “report4.txt”, and “report5.txt”, “Find and Replace Text” option can be selected. “File” can be entered in the “existing text” field while “report” can be entered in the “Replace with” field and the “Rename” button will be pressed:
In order to verify the bulk renaming, we can access the Directory again:
From the above image, it can be verified that files are renamed from “file1.txt”, “file2.txt”, “file3.txt”, “file4.txt”, and “file5.txt” to “report1.txt”, “report2.txt”, “report3.txt”, “report4.txt”, and “report5.txt”.
Conclusion
Files can be renamed in bulk in the command line by using Remane, QMV, and MMV utilities while Graphically by Thunar File Manager and Ubuntu’s Default File Manager. There are many other methods available for renaming the files in bulk on Linux/Ubuntu 22.04 LTS but the five best methods are demonstrated in this article. A user can choose a program that best matches his requirements.