Rename a file in the Linux terminal

To rename a file in the terminal, move the file with mv from itself to itself with a new name. Here's an example.
24 readers like this.
rename files

CC BY-SA Seth Kenlon

To rename a file on a computer with a graphical interface, you open a window, find the file you want to rename, click on its name (or right-click and select the option to rename), and then enter a new name.

To rename a file in the terminal, you actually move the file with mv, but you move the file from itself to itself with a new name.

This example renames example.txt to file.txt:

$ mv example.txt file.txt

Because they both use the same command, you can combine rename with a move. For instance, when moving example.txt to Documents, you could also rename it:

$ mv example.txt ~/Documents/file.txt
What to read next
Seth Kenlon
Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time.

Comments are closed.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.