Last Updated on April 28, 2023 by admin
Multiple Ways To Rename Multiple Files At Once In Linux
There are multiple ways to rename multiple files at once in Linux based operating system.
How To Rename Multiple Files At Once In Linux
Let’s have a look at the methods to rename multiple files at once in Linux-based operating systems.
Bulk rename files using rename utility in Linux
The rename command comes preinstalled in most of Linux-based operating systems. If it is not available by default, run the following command to install:
sudo apt install rename
Now, if you want to rename the following files.
$ ls xyzd1.txt xyzd2.txt xyzd3.txt
Run the following command to replace the first occurrence of xyz with efg
$ rename 's/xyz/efg/' *
Rename multiple files at once using vimv in Linux
Vimv is a command line utility to bulk rename files, Vimv uses Vim editor to rename multiple files at once. Run the following command at first to install Vimv.
Git clones the repository of vimv:
$ git clone https://github.com/thameera/vimv.git
Copy the Vimv binary to your
$ sudo cp vimv/vimv /usr/local/bin/
Finally, now you need to make it executable:
$ sudo chmod +x /usr/local/bin/vimv
Now you are ready to start it. Go to the directory and run the following command.
In the editor, You will see the filenames that you can rename at once. It is pretty simple to use. Once done, press
ESC the key and type
:wq to save and exit.
Rename multiple files at once using mmv in Linux
Run the following command to install mmv in Linux based operating system.
sudo apt-get install mmv
You have the following files and you want to rename them:
ls g1.txt g2.txt g3.txt
Run the following command to rename all files starting with the letter
"h", simply run:
$ mmv g\* h\#1
Some of the other tools that you can use to rename multiple files in Linux at once are:
- Smart File Renamer