Renaming files on Linux is much easier than you think. The default file manager integrates many functions, including file renaming. Continue reading this article by Mytour to explore some ways to rename files on Linux.
Renaming files on Linux using the file manager
If you want to rename a file to make it easier to remember, such as important files to avoid confusion with others on Linux. When using standard Ubuntu or Fedora versions, two popular Linux distributions, the desktop interface you see is called GNOME.
On GNOME, you can rename multiple files at once by selecting them, right-clicking, and choosing Rename. The next window will display options allowing you to rename files using templates or swapping text strings.
Additionally, if desired, you can use file managers like KDE or Xfce to rename files.
Use pyRenamer to rename files on Linux
Depending on your needs, you can seek assistance from advanced programs or tools to rename files. The tool Mytour wants to mention here is pyRenamer.
Download pyRenamer here and install it: Download pyRenamer
In the pyRenamer window, the left pane is for browsing folders and the right pane is for selecting files. The middle pane displays how files look before and after renaming. Additionally, in the right pane, there are options allowing users to keep the file extension unchanged and preview automatic changes to the file extension.
The options below allow users to input name templates they want to see, hover over text boxes to see available templates. These options include numbers, creation dates, times, image metadata, and audio tags.
To save templates, simply click the Save icon next to the frames. The adjacent icon allows you to open existing templates, so you don't have to remember the complex formulas used to rename music or image files.
To install pyRenamer on Ubuntu or Ubuntu-based distributions, all you need to do is open Terminal and enter the following command:
sudo apt-get install pyrenamer
Rename files on Linux using KRename
pyRenamer works well on Linux computers, but if you're using KDE Plasma, you'll definitely appreciate applications written in the Qt programming language like KRename as an alternative. Software like this tends to integrate better with the rest of the interface.
Essentially, Krename's features are similar to pyRenamer, with the difference being a more user-friendly navigation interface.
Download Krename to your machine and install it here: Download Krename
To activate advanced features, such as the ability to translate file names from other languages to English, we can rely on third-party plugins. Thanks to KDE programs being integrated with each other, users can easily access KRename from Dolphin, the default file manager on Linux.
To install Krename on Ubuntu or Ubuntu-based distributions, open Terminal and enter the following command:
sudo apt-get install krename
Rename files on Linux via Terminal
Terminal commands on various Linux distributions are quite similar. The rename commands below work on all Linux-based operating systems or desktop environments, and even work on servers.
Using the 'mv' command to rename files on Linux
The simplest way to rename files on Linux via Terminal is to use the 'mv' command. 'mv' stands for moving files, and it's used to move files. Technically, you can move data from one file name to another. For example:
mv /home/user/Downloads/old-file-name /home/user/Downloads/new-file-name
Alternatively, you can open or direct Terminal to the folder containing the file:
Navigate to /home/user/Downloads/ directory
Rename old-file-name to new-file-name
Note: If you truly want to move files using the mv command, instead of entering the new file name, you enter the replacement directory.
Move /home/user/Downloads/old-file-name to /home/user/Documents/
Using the 'rename' command to rename files on Linux
Renaming individual files one by one is both time-consuming and tedious. In such cases, you can utilize the rename command as an alternative.
Suppose you want to rename a batch of text files (TXT) to Markdown files (MD). First, we use the cd command to navigate to the relevant directory (or alternatively right-click => open in Terminal). Then enter the following command:
rename .txt .md *
The asterisk * indicates searching for all files in the directory. To clearly specify searching for files ending with the extension .txt, we use the following command:
rename .txt .md *.txt
These commands will not provide you with notifications about the changes made; instead, you'll have to open the directory and check manually. If you want confirmation in the Terminal window, you can add -v to the command.
rename -v .txt .md *
From a technical standpoint, you can also use the rename command to rename a file, but you have to enter a longer command compared to the mv command. For example:
rename old-file-name new-file-name old-file-name
Repeating the original file name at the end, instead of using the asterisk *, indicates that the command only applies to this specific file.
This article from Mytour just guided you through some ways to rename files on Linux. Additionally, if you have any doubts or questions that need answering, readers can leave their comments below the article. In the case of using a Macbook, you can refer to how to rename files on Mac here.