How to rename a file in Linux – Terminal and GUI examples

How to rename a file in Linux

If you have just started working with Linux, you might land up with the question, how to rename a file in Linux? This guide has examples using terminal / command-line and GUI tools.

There are just two ways to rename files and directories in Linux. One being the terminal way using mv command, whereas other method includes using a GUI tool.

There is no dedicated command in Linux for renaming files and folders.

The problem with mvcommand is that you cannot use it to rename multiple files or folders in one shot. You might have to do it individually for each file and folder. Which is obviously not a great idea.

Fortunately, the Linux community is so great they have some or the other terminal commands ready to tackle a problem. So if you want to rename all those pictures from last year’s Christmas, we have got you back.

[su_label type=”success”]Suggested read[/su_label] Do you face issues downloading files in Linux ? Here are the few best ubuntu downloaders.

Let’s see quickly how can we achieve a solution to the problem.

Rename a file or directory with mv command

The very basic and easiest way to rename a file in Linux is to use mvcommand without any additional flags or complexity.

Even though the primary purpose of the command is to move files and folders, it serves the purpose of renaming also very well. This is because OS interprets the operation of renaming as moving files from one folder to another.

Syntax to rename files :

mv source_file_name dest_file_name

Example :

mv myfile.txt myRenamedFile.txt

Syntax to rename directories :

mv source_dir_name dest_dir_name

Example :

mv myfolder myRenamedFolder

There are some options which can be very useful while using mv command. Few of them are :

  • -vflag: It prints verbose output, as in log of all operation that are performed during mvcommand execution.

Syntax :

mv -v myfile.txt myRenamedFile.txt

Output :

‘myfile.txt’ -> ‘myRenamedFile.txt’
  • -iflag: This will prompt you before overwriting any existing file if it exists. This helps prevent data corruption for the already existing files.

Syntax :

mv -i myfile.txt myRenamedFile.txt

Output :

mv: overwrite ‘myRenamedFile.txt’? y

To see other options available with mvcom4  mand, you can use the below command and it should help.

mv --helpor man mv


mv commands

[su_label type=”success”]Suggested read[/su_label] If you are a Linux geek, you might be interested in Understanding syslog, rsyslog, syslog-ng, journalctl.

Rename a file in Linux using GUI tool

There are ‘n’ numbers of tools out there for achieving the purpose of renaming files in Linux. Today we will be talking about one such tool.


Métamorphose is a file and folder renamer tool that is widely supported across many platforms.

There many people who still prefer GUI tools even on Linux or Mac OS to do most of their operations. Tool is specifically targeted for them. Métamorphose is quite a powerful tool that can be used.

How to get started?

Head to its website and download the installer package based on your Linux distro. You get an option to download a .debpackage for Debian based distros whereas .rpmpackage for Fedora, Mandriva, and SUSE.


After downloading just run the app package and then follow the steps provided below.

  1. From the “Picker” tab select the directory that contains the files which are to be renamed.
  2. Select as many as files you want. You can even select a child directory which will rename the directory keeping name of its content as same.
  3. Post selecting the files, click the “Renamer” tab. Set some rules based according to you. Rules are required to rename all files and folders accordingly.
  4. With the rules set, lastly, we need to hit that “Go” button and that should be it.

[su_label type=”success”]Suggested read[/su_label] Have a look at our Linux ls command usage guide.

I hope this would have helped you rename files and folders. Let us know if there are some other ways to achieve the same.

Leave a Comment

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

Scroll to Top