How to Rename a File in Linux using Command

You are a beginner to the Linux commands right? No worries, it is extremely easy to rename Linux files using the terminal. All you have to do is to use the ‘mv’ command in the terminal. In this article, we are going to teach you how to use that command to rename a file in Linux using the terminal.

How to Rename a File in Linux using Terminal

Let’s assume that the file that you want to rename is “mydocz.pdf” and you want to rename it as “mydocs.pdf”. To rename it.

  1. Open the terminal by navigating to Applications > Accessories > Terminal.
  2. Type the following command,
    cd /home/techhacker/docs/files

    mv mydocz.pdf mydocs.pdf
    Here, in the first line, enter the location of the file. In our case, it was located in /home/techhacker/docs/files directory. Also, replace the file names with yours.
    You can also write this command as,

    mv /home/techhacker/docs/files/mydocz.pdf /home/techhacker/docs/files/mydocs.pdf

  3. After entering them, just press Enter and your file will be renamed instantly.

That’s all what you have to do for renaming the files in your Linux system. It is recommended to double check all commands on the terminal especially if you are a beginner. Any mistakes in the command may cause some problems to the files if the mistake matches with some other working commands.

We hope, you got the desired results and had successfully renamed the file. If you faced any difficulties in the process, feel free to leave a comment in the following comment section. We will be happy to help you as soon as possible.

Tags:

Muhammed Swalih is a Blogger by profession who also has a great taste in Web Development, SEO, Graphic Designing, etc.
We will be happy to hear your thoughts

      Leave a Reply

      Thetechhacker
      Register New Account
      Reset Password