How to bulk rename files in Linux?


This article will cover a guide on various methods that can be used to bulk or batch rename multiple files at once in Linux. Some of these applications feature a graphical interface, while others can be used from the command line.

Rename Command

Rename command is available by default in most Linux distributions, and it can be used to batch rename multiple files and folders at once. In case it is not available by default on your Ubuntu installation, you can run the command below to install it:

$ sudo apt install rename

You can install rename in other Linux distributions from the package manager. You can also compile it from its source code available here.

The Rename command is written in Perl, and you have to use “Perl Expressions” to batch rename files. If you have already used regular expressions in programming languages like Python, you will find Perl expressions similar though there are some differences. Below are some most common use cases and patterns for the Rename command. For advanced and custom use cases, you may refer to the documentation for Perl expressions.

To rename multiple files at once by replacing a substring, run a command in the following format:

$ rename -v ‘s/substring_to_be_replaced/replacement_string/’ file1.txt file2.txt file3.txt

For instance, assuming there are three files in a folder having names “file1.txt”, “file2.txt” and “file3.txt”, the command below will replace substring “file” with “text”, resulting in new names being “text1.txt”, “text2.txt”, and “text3.txt”.

$ rename -v ‘s/file/text/’ file1.txt file2.txt file3.txt

After running the above command, you should get the following output in the terminal:

file1.txt renamed as text1.txt
file2.txt renamed as text2.txt
file3.txt renamed as text3.txt

You can also select multiple “n” numbers of files that use the same extension using the asterisk (*) wildcard character.

$ rename -v ‘s/file/text/’ *.txt

The command above can also be used to remove substrings. To do so, do not supply any string or character in the second part of the command. In other words, keep the replacement string blank by completely omitting the second part.

You can prepend a string (without replacing anything) before file names using a command in the following format:

$ rename -v ‘s/^/your_prefix/’ *.txt

Replace “your_prefix” part with your desired prefix. For instance, the command below will prefix “.txt” files with “text_” prefix.

$ rename -v ‘s/^/text_/’ *.txt

To append a string at the end of file names but before the extension, use a command in the following pattern:

$ rename -v ‘s/.txt$/your_suffix.txt/’ *.txt

Replace all three “.txt” parts with your required file extension and replace “your_suffix” part with your required suffix. For example, the command below will add a suffix “text” to “.txt” files.

$ rename -v ‘s/.txt$/text.txt/’ *.txt

Note that all commands listed above can also be used to bulk rename directories.

Using Default File Managers Shipped with the Distribution

Many file managers in Linux distributions have built-in support for batch renaming files. For example, file managers like Caja, Nautilus, and Dolphin can rename multiple files at once through a GUI interface. To invoke the bulk rename tool, select multiple files and hit key. You can also find an entry for the bulk rename option in the “Edit” menu option. The screenshot below shows the batch rename tool in Caja file manager, installed by default in Linux distributions using the MATE desktop environment. You can find similar options in other file managers by looking into the main menu bar located at the top.

As visible in the screenshot, the graphical rename tool can run several insertion and replacement operations on the selected files. You can also install these file managers in any Linux distribution using any desktop environment, and they can be used in conjunction with pre-installed file managers.


CoreRenamer is a free and open-source graphical file renaming tool available for Linux. You can use it to add substrings, replace existing substrings, format names using various patterns, modify file extension names, and so on. It also comes with an undo and redo feature so that you can revert your changes before clicking on the “Rename” button.

You can download and install CoreRenamer in all major Linux distributions from the FlatHub store.


KRenamer is a free and open-source bulk rename tool available as a part of the KDE application stack. It can also be used in other desktop environments that don’t use KDE libraries by default. It can rename files using a variety of patterns, including replacing, adding, and removing substrings. It can also change the case of file names and comes with a few useful plugins. One of the plugins can be used to rename files based on the metadata information it contains. Other plugins can add counters, add current date and time, or transliterate strings.

Image source

You can install KRename in Ubuntu using the command mentioned below:

$ sudo apt install krename

KRename can be installed in other Linux distributions from the package manager. You can also compile it from its source code available here.


These are some of the best ways to rename multiple files at once in Linux. These commands and applications can be used to batch rename both files and directories using pre-defined or user-defined patterns.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More