Home / VPS & Dedicated / How to rename multiple files in Linux

How to rename multiple files in Linux

Tux, Linux mascotThe ability clusters of files is a handy skill to have when running a dedicated server or VPS, and in some cases, it is absolutely necessary. For example, if you ever need to migrate from one server to another or from one software/application system to another, you might need to change bulk amounts of files for the sake of compatibility.

Renaming one file is easy with the “mv” command:

mv filename newfilename

To rename multiple files, you need the “rename” command. Before the rename command, Unix system administrators had to rely on complex scripting to perform batch renames. Now, if you want to change all your .html files to .htm files, for example, it is as simple as a one line command string:

rename .htm .html *.htm

This will find all files that end in .htm (*.htm) and replace the .htm with .html. This works well for simple renaming schemes. For more complicated ones, you still need some scripting expertise.

Check Also

Uk data center

Professional Data Centres In The UK

A professional data centre is a location in which various pieces of hardware are located …