Bulk File Renaming in Linux
Sometimes I need to rename a bunch of files all at once. This is especially useful when mass-renaming/bulk-renaming photos. For instance, I want to rename file unnamed-1.jpg
through unnamed-29.jpg
to high_res-1.pg
through high_res-29.jpg
, respectively. How can I easily do this easily in Linux Ubuntu? Perhaps you might take the time to do this manually for 29 photos, but what about for 1000 photos? How can we automate this process using a simple, easy-to-use GUI tool?
Simple:
How to use the Thunar Bulk Rename GUI to rename files in Linux
(tested in Ubuntu 20.04)
-
Install the
thunar
file manager GUI tool which comes with a handy “Bulk Rename” utility. Type the following into a terminal (you can open a terminal window withCtrl
+Alt
+T
):sudo apt update sudo apt install thunar
-
Now open it up by clicking on the Ubuntu “start menu”/”launcher”, and type in “thunar” or “rename”. If you type in “thunar”, here’s what you’ll see. Click on “Bulk Rename” to open it up:
-
In the GUI that opens, click the
+
symbol in the top-left to select your files: - Either manually navigate to them, or press
Ctrl
+L
to bring up a “Location” bar you can directly type or paste a folder path into. If pasting a folder path, ensure it does NOT end in/
or else it will act finicky. Once you are in the folder you want, use whatever technique you like best to select the files you’d like to rename:Ctrl
+Click
to individually select files.- Or
Shift
+Click
to select a range of files. - Or
Ctrl
+A
to select all files.
Once you have the files selected which you’d like to rename, click
Open
. - Now choose your settings. It does support Regular Expression (regex) searches, which is great!
- For my case, I simply choose “Search and Replace” on the left, searching for
unnamed
and replacing it withhigh_res
, as shown below. Notice that you can see a preview of what the “New Name” will be before it even does the renaming!
- For my case, I simply choose “Search and Replace” on the left, searching for
-
Click “Rename Files” when ready. And voilá! The files are all magically bulk-renamed! Done.
References
- I first learned about Thunar’s bulk rename utility from somewhere else, but I can’t remember where.
- I used the beautiful “Shutter” tool for taking and editing/highlighting all screenshots. I highly recommend it! To enable Shutter’s “Edit” button in the top-right of its GUI interface for Ubuntu 18.04 or later, however, you must follow these steps here.
Going Further
I recommend you use thunar
for its wonderful Bulk Rename utility, but use nemo
for its wonderful user interface.
The default file manager in Ubuntu is nautilus
. Personally, I really hate nautilus, since it has such horrible usage of space and can’t show very many files at once. So, I strongly recommend nemo
. See my thorough answer on how to install and configure nemo
in Ubuntu here: Ask Ubuntu: How to set Nemo as the default file manager.
Here’s the beautiful nemo, in all its glory, in “Compact View”, NOT zoomed all the way out. Look at how many files you can see at once! It has excellent space usage to make it a very practical tool!
…as compared to the atrociously space-wasting views available in Ubuntu’s default nautilus file manager, which can only show a fraction as many files at once :(:
1/2: Icon view in nautilus (zoomed all the way out) (horrible space usage):
2/2: List view in nautilus (zoomed all the way out) (horrible space usage--reminds me of Apple's "Finder" :():
Note: if you like the Icon and List views shown in nautilus above, nemo can do those too, so you’re not losing anything by getting nemo.
Leave a comment
Comments are powered by Utterances. A free GitHub account is required. Comments are moderated. Be respectful. No swearing or inflammatory language. No spam.
I reserve the right to delete any inappropriate comments. All comments for all pages can be viewed and searched online here.
To edit or delete your comment: Option 1 (recommended): click the date just above your comment, ex: the
just now
or5 minutes ago
(or equivalent) part where it saysYOUR_NAME commented just now
orYOUR_NAME commented 5 minutes ago
, etc., or Option 2: click the "Comments" link at the top of the comments section below where it says how many comments have been left. Option 1 will take you directly to your comment on GitHub. Option 2 will take you to a GitHub page with all comments for this page. Then: --> find your comment on this GitHub page and click the 3 dots in the top-right of your comment --> click "Edit" or "Delete". Editing or adding a comment from the GitHub page also gives you a nicer editor.