How to rename files in Ubuntu 20.04

s2 0

Renaming a file is a basic process in any operating system. Files can be renamed in a number of ways on Linux. The task can be performed through the GUI or the command line. In addition, advanced utilities can also be used to rename these files. All of these possibilities are documented in this article in an easy to understand way.

requirements

  • Ubuntu 20.04 system
  • User with sudo permissions to rename multiple files.

Note: The commands discussed in this article have been tested on Ubuntu 20.04 LTS (Focus fossa).

Method # 1: Renaming Files Using GUI

We are going to rename a file by the name File.txt.

Right click on the file to be renamed. A menu will appear on the screen.

click on the rename. The name of the file becomes editable.

C:  Users  Muhammad Usman  Downloads  mv  mv5.png

Write the name of the new file and press Enter.

C:  Users  Muhammad Usman  Downloads  mv  mv6.png

The file is renamed.

C:  Users  Muhammad Usman  Downloads  mv  mv7.png

Method # 2: Renaming Files Using the mv Command

The mv command has the following syntax.advertising

mv [source] [destination]

Right-click the folder where the file you want to rename is located.

C:  Users  Muhammad Usman  Downloads  mv  mvv.png

Click on open in the terminal to open the directory in the command line.

C:  Users  Muhammad Usman  Downloads  mv  mv0.png

We will use mv File move utility. The filename File.txt can be renamed to document.txt with the following command:

$ mv file.txt document.txt

C:  Users  Muhammad Usman  Downloads  mv  mv1.png

The file can be checked for renaming. Run the following command in the terminal:

$ ls

C:  Users  Muhammad Usman  Downloads  mv  mv2.png

Method # 3: renaming multiple files with the rename command

Run the following command on the terminal to install the rename utility.

Rename $ sudo apt install -y

C:  Users  Muhammad Usman  Downloads  mv  mv8.png

We’re going to rename several files to TXT Files to md Files. The name or the equivalent text file remains name when its extension is moved to Markdown. We have three text files as the following picture suggests.

C:  Users  Muhammad Usman  Downloads  mv  mv10.png
Run the following command in Terminal to rename all of these files:

Rename $ ‘s / . txt $ / . md /’ * .txt

C:  Users  Muhammad Usman  Downloads  mv  mv12.png

  • ‘s / . txt $ / . md /’ – Replace .txt in place of .md.
  • * .txt – Apply the operation to the name of all files.

The files can be checked for renaming with the following command:

$ ls

C:  Users  Muhammad Usman  Downloads  mv  mv13.png

diploma

In this article, we have explored how to rename a file using both the GUI and the command line. A utility to rename multiple files at once was also investigated. We hope you can easily rename files and folders in Linux after following this article.

How to rename files in Ubuntu 20.04
Tags: