You may or may not be familiar with the term “terminal“.

In a computer program, a terminal is a basic path by which you can make changes in the information stored on your computer. It is basically a program in which you write commands.

Once the proper command is written, the task will be executed. This includes deleting your files, renaming them, or anything that you simply do by using normal Graphical User Interface or GUI.

For example, there are two simple ways by which you can create a new file or a folder on your computer. Here is the first one, suppose you are going to create a new file or a folder in your Documents directory. You’ll just open the directory of Documents, right-click on the screen and the drop-down box will open, click on ‘New Folder’ from the drop-down menu, and just like that, a new file is created. Easy!

Another way to create a new file is by making use of the command line or a terminal, an old classic way. To create a new file or folder with terminal, type the following:-

cd ~/Documents
mkdir new folder

Yes, seems a bit geeky and complicated, but this is how computers used to be operated when there were no GUIs. Some people still prefer this method.

In this article, we’ll cover how to rename files terminal that already exist.

Why use terminal instead of GUI?

Before today’s fancy user interfaces and sharp layouts were made, computers used to run on terminals only. People had to type every command to make changes on the computer. As time has passed, people have forgotten how to do this. But some people still learn and prefer it because it was the first-ever way to control a computer.

To be honest, a typical interface of the computer can often be glitchy. However, Terminal doesn’t ask you to find senseless menus and silly buttons. Terminals only require you to use your keyboard – you don’t even need to use the mouse. To turn your hand to the terminal and be a pro can be a little bit hard and complicated. But once you get used to it, you’ll forget the other options exist.

Different operating systems have different terminals. Linux and Mac, two famous operating systems for coding, use mv command as to their terminal, while Windows uses Command Prompt as its terminal. Usually, when people talk about terminals, they mean Linux OS or Mac Os, because Windows is not used or preferred for any type of coding. To start the process of changing the file name with the terminal or command, we’ll start with the Mac Operating System.

Okay, now let’s move to our next question.

Do you know how to rename a file in Mac OS using Terminal?

Mac OS is the Operating System for the computer which has gained a reputation in the coding world for being influential and smooth. If you are willing to rename your file or let’s say you want to bring change to the files in Mac OS, then the mv command should be used. This command is ideal for modifying the file name and also possesses the ability to drag it from place to place. If the file you’re currently working on has to be renamed or modified, then use this command:

mv old-folder-name new-folder-name

On the other hand, if you want to modify or rename a folder that not presently working on, then write:

mv /full-path/old-folder-name /full-path/new-folder-name

Now your previous filename has been changed to the modified one.

Note: To see the folder or a file you’re currently working on, you have to enter the password in command box before you hit the tab “Enter”.

How to Rename Files in Linux Using Terminal 

Are you using Linux and are confused about the process of renaming in Linux using Terminal?

Now we’ll take our next step: renaming files and folders in the terminal of Linux OS. There are typically two ways to rename files or folders in Linux OS, firstly what you have to do is to change the name by the help of the usual command line, the second one is to rename your files or folders by using rename command.

Rename Command is the default command line that is pre-installed in every LinuxOS configuration or distribution. But first, we will be renaming files and folders using the command line of mv command.

Mv is a command line in the terminal that can change file navigation and can also easily modify files. Mv command is certainly an easy-to-handle command line, as claimed by the geeky programmers. Now we will explain how mv command actually works on the Linux OS to give the file a modified name.

First, you need to access your server. But how are you going to access it? It can be accessed by using the command line SSH (or any other command line you specifically have). To access your server, open the terminal and type:

ssh [email protected]

The terminal can be opened from the main or the core menu if you’re not using any sort of server.

Now on the actual step, you can change the file name or folder name by typing:

mv oldnamefile1 newnamefile1

Suppose if “file1.txt” has to be renamed to “file2.txt”. Then we’ll need to type:

mv file1.txt file2.txt

That’s how you can give your file a new name assuming the folder is placed in the current directory. If you want to create a new file name and it is not in the folder which you’re currently working on, then you’ve got to press some more buttons for a new file name:

cd >> home >> user >> docs >> files >> mvfile1.txt file2.txt

How to Rename Multiple Files in Linux using Terminal

In the above section, we talked about how to rename a single file. But what if you want to rename large quantities of files and folders? What will you do then? Don’t worry.

By following a few easy steps, you can easily rename multiple files. Keep in mind that we’ll be using mmv command instead of mv command. Mmv is a command or a utility that can be installed and used to rename files or change their location in bulk quantity.

Let’s suppose you have the files you want to rename in the directory you’re currently working on. You will type:

  • $1s
  • c1.txt c2.txt c3.txt

For example, you may need to rename all the files starting with the letter ‘c’ to the letter ‘d’. If you did that manually, it would take you hours. But with mmv command, multiple files can be easily renamed.

To rename all the files starting with letter ‘c’ to ‘d’, type:

$ mmv c\*d\#1

Now we’ll make sure that files have actually been renamed.

  • $1s
  • d1.txt d2.txt d3.txt

As it’s visible, the files beginning with the letter ‘c’ have been changed into ‘d’.

And this is how multiple files and folders can be easily renamed in Linux terminal using the mmv command.

How to Rename Files and Folders in Linux using Rename Command

We mentioned above that rename command is usually a default command line in Linux configurations. Rename command gives you more control than mv command because it is initiated by the operating system. However, if it is not pre-installed, you can download it in a few steps. Following are the steps to download the rename command to change the file name in specific Linux distributions:

  • For Linux distributions like Debian, Ubuntu, Linus Mint, type: sudo apt install rename
  • For CentOS7 or RHEL, type: sudo yum install rename
  • For Arch Linux, type : yay perl-rename ## or yaourt -S perl-rename

This is how simply you can rename the folder in Linux OS or its configurations. It feels complicated at the start but once you know what you’re doing, it’s a piece of cake.

Renaming Files in Windows 10 Terminal

Windows 10 is also one of the most widespread operating systems released by Microsoft. Although it’s not preferred for programming or coding, it is highly popular in the general computing world.

We think it’s fair to talk about Windows 10 terminal because there may be some people who prefer Windows 10 while coding. In this case, it is essential to know how to rename a file or a folder in Windows 10 terminal.

So to rename a folder in Windows 10 terminal, Command Prompt has to be used. Just as we use mv command in Mac and Linux, we’ll use Command Prompt in Windows 10.

Open the Command Prompt from the Start menu, then navigate to the directory in which the folders or files you want to rename are located. For instance, to instantly open the contents of a document folder, type:

cd %USERPROFILE%\Documents

To give the file a new name, type:


Quotation marks should only be typed when the name of the file includes space, otherwise, the use of quotations can cause an error.

Final Thoughts

These concepts will surely help you to use of terminal to rename a file, multiple files, and folders either singly or in batches, whether on Linux, Mac, or Windows. All these methods will quickly and easily change the file name.