Multiple Ways To Rename Multiple Files At Once In Linux

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.

Method 1:

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/' *

Method 2

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 $PATH

$ 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.

$ vimv

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.

Method 3:

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 "g" to "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:

  • renameutils
  • Emacs
  • Thunar
  • KRename
  • Smart File Renamer
READ More Relevant Stuff:  Install GParted On Ubuntu 22.04 LTS In 2023

Leave a Reply

Your email address will not be published. Required fields are marked *