You were right to consider rename first. The syntax is a little strange if you're not used to regexes but it's by far the quickest/shortest route once you know what you're doing:

rename 's/\d{4}/2503/' file*

That simply matches the first 4 numbers and swaps them for the ones you specified.

And a test harness (-vn means be verbose but don't do anything) using your filenames:

$ rename 's/\d{4}/2503/' file* -vn
file0901201437404.p renamed as file2503201437404.p
file0901201438761.p renamed as file2503201438761.p
file1003201410069.p renamed as file2503201410069.p
file2602201409853.p renamed as file2503201409853.p
file2602201410180.p renamed as file2503201410180.p
Answer from Oli on Stack Exchange
🌐
LinuxConfig
linuxconfig.org › home › how to rename multiple files on linux
Rename Multiple Files on Linux with mv, rename, mmv
September 22, 2025 - Renaming multiple files with the mv command is easier if you know a little bit of bash scripting.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to rename files in linux
How to Rename Files in Linux (Multiple Options and Examples)
December 9, 2025 - The last line ends the loop segment. Save the changes to the script and exit. ... Note: Learn how to compare two files using the diff command. The rename command can rename multiple files or directories in Linux.
Top answer
1 of 8
213

I use rename all the time. It is pretty simple, but hopefully you know basic regex:

rename "s/SEARCH/REPLACE/g"  *

This will replace the string SEARCH with REPLACE in every file (that is, *). The /g means global, so if you had a SEARCH_SEARCH.jpg, it would be renamed REPLACE_REPLACE.jpg. If you didn't have /g, it would have only done substitution once, and thus now named REPLACE_SEARCH.jpg. If you want case-insensitive, add /i (that would be, /gi or /ig at the end).

With regular expressions, you can do lots more.

Note that this rename is the prename (aka Perl rename) command, which supports complete Perl regular expressions. There is another rename which uses patterns, and is not as powerful. prename used to be installed by default on Ubuntu (along with Perl), but now you may have to do:

sudo apt install rename

Here are a few examples:

Prefix

Add:

rename 's/^/MyPrefix_/' * 
  • document.pdf renamed to MyPrefix_document.pdf

Remove:

Also you can remove unwanted strings. Let's say you had 20 MP3 files named like CD RIP 01 Song.mp3 and you wanted to remove the "CD RIP" part, and you wanted to remove that from all of them with one command.

rename 's/^CD RIP //' *
  • CD RIP 01 Song.mp3 to 01 Song.mp3

Notice the extra space in '^CD RIP ', without the space all files would have a space as the first character of the file. Also note, this will work without the ^ character, but would match CD RIP  in any part of the filename. The ^ guarantees it only removes the characters if they are the beginning of the file.

Suffix

Add:

rename 's/$/_MySuffix/' *
  • document.pdf renamed to document.pdf_MySuffix

Change:

rename 's/\.pdf$/.doc/' *

will change Something.pdf into Something.doc. (The reason for the backslash is, . is a wildcard character in regexp so .pdf matches qPDF whereas \.pdf only matches the exact string .pdf. Also very important to note, if you are not familiar with BASH, you must put backslashes in SINGLE quotes! You may not omit quotes or use double quotes, or bash will try to translate them. To bash \. and "\." equals .. (But double-quotes and backslashes are used, for example "\n" for a newline, but since "\." isn't a valid back escape sequence, it translates into .)

Actually, you can even enclose the parts of the string in quotes instead of the whole: 's/Search/Replace/g' is the same as s/'Search'/'Replace'/g and s/Search/Replace/g to BASH. You just have to be careful about special characters (and spaces).


I suggest using the -n option when you are not positive you have the correct regular expressions. It shows what would be renamed, then exits without doing it. For example:

rename -n s/'One'/'Two'/g *

This will list all changes it would have made, had you not put the -n flag there. If it looks good, press Up to go back, then erase the -n and press Enter (or replace it with -v to output all changes it makes).

Note: Ubuntu versions above 17.04 don't ship with rename by default, however it's still available in the repositories. Use sudo apt install rename to install it

2 of 8
22

Try pyrenamer.

It's not integrated with nautilus, but it gets the job done. Here is a review.

Thunar (part of XFCE) also has a renamer that you can run separately.

🌐
nixCraft
cyberciti.biz › nixcraft › tutorials › linux › linux rename multiple files at a shell prompt
Linux Rename Multiple Files At a Shell Prompt - nixCraft
February 26, 2025 - The syntax is: $ rename oldname ... $ zmv '*' '${(L)f}' See zshwiki for more info on zmv. You can use the mmv command to move/copy/append/link multiple files....
🌐
Batsov
batsov.com › articles › 2020 › 11 › 21 › rename-multiple-files-in-linux
Rename Multiple Files in Linux | (think)
November 21, 2020 - One simple option is to use the rename utility from the util-linux package: Basically you’re doing a text substitution in the list of files passed to the command. The problem with this is that it won’t work properly in cases like markdown.markdown. Fortunately, Debian and Debian-derived distributions (e.g. Ubuntu) ship a more powerful version of this command, that’s written in Perl, and supports regular expressions.
Find elsewhere
🌐
Baeldung
baeldung.com › home › files › how to rename multiple files in linux by removing the extension
How to Rename Multiple Files in Linux by Removing the Extension | Baeldung on Linux
March 18, 2024 - For this, we’ll add the following code in the Bash script: for file in *.xls; do mv $file `echo $file | cut -d. -f1` done · After saving the file and exiting the editor, let’s run the script: ... Lastly, we can use the ls command to check the filenames to ensure that the script has run successfully. In addition to mv, there’s a rename command that can also be used to rename multiple files in Linux.
🌐
OSTechNix
ostechnix.com › home › linux tips & tricks › 8 methods to rename multiple files at once in linux
How To Rename Multiple Files At Once In Linux - OSTechNix
November 13, 2025 - If you have the Nemo file manager you can also install thunar and then open nemo and click on edit – preferences then click on behavior and scroll to the bottom and insert the command “thunar -B” in the Bulk Rename command slot and it will ...
🌐
TecMint
tecmint.com › home › linux commands › rename – a command line tool for renaming multiple files in linux
A Command Line Tool For Renaming Multiple Files in Linux
May 24, 2024 - The rename command is used to rename multiple files, convert filenames to lowercase and uppercase, and perform file renaming using Perl expressions.
🌐
Ubuntu Community
help.ubuntu.com › stable › ubuntu-help › files-rename-multiple.html.en
Rename multiple files
Select two or more files in Files. Press F2 or right-click on the selection and pick Rename.
🌐
Linuxize
linuxize.com › home › linux commands › how to rename files and directories in linux
How to Rename Files and Directories in Linux | Linuxize
March 12, 2026 - The mv command (short for move) is used to rename or move files from one location to another. The syntax for the mv command is as follows: ... The SOURCE can be one or more files or directories, and DESTINATION can be a single file or directory.