How to Rename Files in Linux + Directories in Linux ? 2023

How to Rename Files in Linux + Directories in Linux Free Download Latest Version {2023} ?

It should be noted that the mv command requires write permission for the folder holding the files. User must have root permission to rename files for device directories and files by adding mv with sudo or su. A further degree of protection is provided by the -i (interactive) option, which enables the user to confirm a file name change before it is put into use.

The -v (verbose) alternative also lists every modification that mv did. Options are written after mv, not before, file names.

Using the “rename” command:

Because it takes regular expression understanding or at least a rudimentary familiarity, this order is a little more complex than mv. Don’t give up on renaming just because it seems intimidating; you can use it by simply using instructions like this one to rename batches.

The renamesyntax looks like this:

rename (option) 's/oldname/newname/' file1.ext file24.ext

The letter “s” stands for “substitute” and is the main part of the regular expression. Single quotes are required. The available options are:

  • -v (verbose: print the list of renamed files with their new names)
  • -n (“no action”: a test mode or simulation that shows only files that will be modified without touching them)
  • -f (forced overwrite of original files)

The ‘rename’ command also accepts wildcards to rename multiple files of the same type, and also works on file extensions.

For example, this would change all files with the extension .jpeg to .jpg:

rename 's/.jpeg/.jpg/' *

The generic symbol (*) means that all the files in the folder will be affected.

The regular expression also has its own options (modifiers): “g” (global; affects all occurrences of the expression) and “i” (performs a case insensitive substitution). They are written to the end of the expression just before the closing single quote and can be combined:

rename -n 's/DSC/photo/gi' *.jpg

Additionally, the programme would change the word “picture” in the file name. However, because “-n” is an option, the command will simply display the files in the console window rather than renaming them. These three types of files—”DSC,” “dSC,” and “dsc”—will all be affected. It will occur.

This expression’s one and only function is not as a substitute. Another conversion that can confuse file names is marked with a period (“y”). The case file’s name is altered more frequently than usual:

rename 'y/a-z/A-Z/' *.jpg

This will rename all.jpg files in uppercase. Instead, simply alter the standard expression’s “old name” and “new name” to do this.

The rename command combines a few straightforward models to produce the desired outcome. The “-n” option offers users a safe and practical overview of what they are called, ensuring that their data (or nerves) are never compromised.


Metamorphoses is a huge replacement file and a cross-platform script. If you need a transaction renaming interface application, Metamorphosis is a highly potent solution. It may be accessed on Linux and Windows.

To get started and download your Distro installation package, visit their website. Includes an RPM kit and a deb file for the Debian-based distributions of Fedora, Mandriva, and SUSE. It can only be used in AUR on Arch Linux.

When the device first starts, this is the first “selector” tab. The directory containing the files you want to delete is your choice. Although only one directory can be selected for each rename operation, child directories can still be accessed within the selected directory.


Select the page, then click the “Rename” tab. The rules for name changes can be selected from this page. In the left panel, you can choose the operation you want to carry out. For instance, “insert” adds words to the name, whereas “length” permits characters to be removed from file names. The options “skip file,” “rotate,” and “move” are also available. You can see that you have a lot of alternatives when renaming your files.


Finally, simply click the “Go” button at the top of the bottom panel to execute the name change action. If you encounter an error after renaming, there is a Cancel option to cancel all changes.

Using Windows 10 with a disabled touchscreen? check out Fix Windows 10 Touch Screen Not Working.

pyRenamer – the easy way out 2023 :

And finally, the response expected by all anti-console users: a desktop application that can perform these tasks with a single mouse button. PyRenamer is a crazy and efficient device written in Python to rename directories. Currently, Ubuntu users and their descendants are obviously free to install renamed py from repositories using the command:

sudo apt-get install pyrenamer


The interface consists of four parts 2023:

  1. a tree-based file finder to select files and folders
  2. a central preview pane that shows file names before and after the name change
  3. a tabbed control area to choose the name change criteria
  4. the side options bar

PyRenamer can automatically add or remove spaces and underscores, alter any text string to another, modify the file name to capital, lowercase, or phrases, and remove accents and symbols from file names. Because everything can be picked by just pressing Rename in the tab section and Preview in the main area, beginners adore it. You can get a cheat sheet from PyRenamer to make playing patterns simpler.


The ability of pyRenamer to rename media files by reading metadata is useful for advanced users. If renaming a series is not feasible, you can also manually rename a single file.

In essence, the new name of py eliminates the commands and combines the mv code into a user-friendly interface. This is a fantastic choice for those who doubt their CLI capabilities.

Of course, there are a variety of methods for changing Linux files, such as writing a script or employing other well-known py tools.

How to Rename Files and Directories in Linux 2023

Renaming files and directories is one of the most essential tasks you frequently need to perform in a Linux environment. You can rename the data using the command line interface or a GUI file manager.

Even for novice Linux users, renaming numerous files at once can be challenging. Renaming a single file is easy.

This manual shows you how to use the mv and rename commands to delete files and directories.

Renaming Files with the mv Command 2023:

The mv (short of move) command is used to rename or move files from one location to another. The syntax of the mv command is as follows:

mv [OPTIONS] source destination

The “source” can be one or more files or directories, and the “destination” can be a single file or directory.

  • If you specify multiple files, it must be a directory. In this case, the files are moved to the destination directory.
  • If you specify a single file as “source” and the destination “destination” is an existing directory, the file is moved to the specified directory.
  • To rename a file, you must specify a single file as the “source” destination and a single file as the “destination” destination.

For example, to rename the file “file1.txt” to “file2.txt”, you should run:

mv file1.txt file2.txt

Renaming multiple files with the mv Command 2023:

The ‘mv’ command can only rename one file at a time, but it can be used in conjunction with other commands such as’ find’ or inside bash ‘for’ or ‘while’ loops to rename multiple files.

The following example shows how to use the Bash for loop to rename all ‘.html’ files in the current directory by changing the extension ‘.html’ to ‘.php’.

'for f in *.html; do 
    mv -- "$f" "${f%.html}.php"

Renaming Files with the rename Command 2023:

To rename several files, use the “rename” command. This command requires a foundational understanding of regular expressions, making it more complex than “mv.”

The “rename” command comes in two separate iterations, each with a unique syntax. The “rename” command in Perl will be used in this tutorial. If your system doesn’t already have this version installed, you may quickly add it by using your distribution’s package manager.

The syntax for the “rename"the command is as follows 2023:

rename [OPTIONS] perlexpr files

The “rename"the command will rename the “files" according to the specified “perlexpr"regular expression. You can read more about Perl’s regular expressions here.

The following example will change all files with the extension “.html" to “.php":

rename 's/.html/.php/' *.html

You can use the ‘-n' option to print names of files to be renamed, without renaming them.

rename -n 's/.html/.php/' *.html

The output will look something like this:

rename(file-90.html, file-90.php)
rename(file-91.html, file-91.php)
rename(file-92.html, file-92.php)
rename(file-93.html, file-93.php)
rename(file-94.html, file-94.php)

By default, the “rename” command does not overwrite existing files. Pass the “-f” option to authorize the overwriting of existing files:

rename -f 's/.html/.php/' *.html


You now know how to rename files using the mv and rename commands from this article. I hope you enjoyed it. Visit our site for further helpful instructions and resources. I’m grateful.

Leave a Reply

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