Three ways to rename a file in Linux

Table of contents:

Three ways to rename a file in Linux
Three ways to rename a file in Linux

Each operating system implies interaction with files. Often the user has to face the need to rename a file. At first glance, there is nothing easier, but in the OS based on the Linux kernel, there are several ways to do the presented operation. In this article, we will talk about three of them.

rename linux file
rename linux file

Method 1: File Manager

Renaming a Linux file for an inexperienced user will be easier with a GUI file manager. This will greatly facilitate the task, as the user will be able to visually control the process. It's also ideal for those people who have just switched from Windows to Linux, as the technology is almost identical.

So, to rename a Linux file in the file manager, you need to:

  1. Launch the file manager itself (in this case, Nautilus, which is distributed in distributions with the Gnome graphical environment).
  2. Go to the folder where the requiredfile.
  3. Click on the file with the right mouse button (RMB).
  4. In the context menu, select "Rename".
  5. Enter a new name.
  6. Press the Enter key.
how to rename file in mc in linux
how to rename file in mc in linux

As mentioned above, renaming a Linux file in the file manager of the system is almost the same as the same operation in Windows. The main difference lies in the graphical interface and in the arrangement of some elements.

Method 2: Console File Manager

There are several ways to rename a Linux file, as discussed above. Now the next one will be dismantled. If you use the server version of the system, then most likely you have already installed the MC console file manager for yourself, however, this program can also be easily used in the Linux desktop using the Terminal for these purposes. Now let's understand in detail how to rename a file in MC in Linux.

So, first of all, you need to enter the file manager itself. It is done with the help of the executed "mc" command. If this program is not installed in the system, then you can install it using the command entered in the "Terminal":

sudo apt install mc

After opening the program in the "Terminal" will show a list of all directories in the home directory. At this stage, you need to find the desired file. By the way, if you use the "Terminal" to launch MC, then there is the ability to gothrough directories with the mouse, double-clicking on the desired one with the left button. If you have a Linux server, you need to use the arrows on the keyboard to navigate and the Enter key to navigate.

When you have the desired file in front of your eyes, you need to select it and press the F6 key. A "window" will appear in front of you, if you can call it that, in which you need to enter a new file name in the second field. Please note that you must first specify the path where the file will be moved. The home directory is selected by default.

Method 3: Linux Console

Finally, we will look at how to rename a file in the Linux console (the local analogue of the "Command line" in Windows).

We will understand with an example. Let's say that in the "Documents" folder, which is located in the home directory, there is a file called "Old Document", our task is to rename it to "New Document". To do this:

  1. Open the console by searching for "Terminal".
  2. Go to the desired folder using the cd command. In our case, you need to run the command: "cd /home/Username/Documents".
  3. Rename the file with the mv command. It is also recommended to use the -v option to display the operation log. In our example, the command would look like this: "mv -v "Old Document" "New Document".
linux rename file in console
linux rename file in console

This was the third way to rename a Linux file. By the way, afterall done actions "Terminal" can be closed.

Popular topic

Editor's choice

  • Let's build iOs apps! Overview of programs, instructions, recommendations
    Let's build iOs apps! Overview of programs, instructions, recommendations

    Today more and more people are starting to dive into the world of IT. A fairly common industry is the creation of various kinds of mobile applications. Quite a lot of different games and programs have already been developed for Android. It is because of this that many developers have begun to move to the iOS platform. This is not a very crowded industry where you can find a lot of clients and make quite a lot of money

  • Moving WordPress to another hosting: features, procedure
    Moving WordPress to another hosting: features, procedure

    Today, every person who has his own website on the Internet may face the problem that he will need to transfer the site to another hosting. There can be many different reasons for this. Of course, the most common of them is dissatisfaction with the services provided. If you can't take it anymore, then you need to act. This is a rather long procedure. If you do everything step by step, you can safely transfer the site, and not redo everything several times

  • How to pass on the rights in "SAMP RP"?
    How to pass on the rights in "SAMP RP"?

    Every person who plays online games is trying to upgrade his character and achieve many interesting things. Users who prefer SAMP try to get a driver's license even from the first level. Experienced players may not take the exam, but simply go to the instructor and buy rights from him. Of course, it will be somewhat more expensive, but this way you can save your time. How to pass on the rights to "SAMP"? Let's review this

  • How to turn off the camera on a laptop? 3 easy ways
    How to turn off the camera on a laptop? 3 easy ways

    Today, hacking has begun to actively develop in the world of information technology. An experienced hacker can get into almost any computer and get the user's information, provided, of course, the laptop is connected to the network. Recently, users have been complaining that their webcam turns on by itself. This way hackers can see where you are and what you are doing. In the future, this information can be used in completely different ways, up to the fact that you become a star on YouTube

  • Shared AppStore Account Features
    Shared AppStore Account Features

    A shared App Store account has many features. It allows users to install games and applications, as well as watch movies in high definition. Shared accounts give official access to app and game downloads for Apple devices (iPhone, iPad, iPod Touch)