How To Rename Files in Linux and macOS Terminal

Renaming files is something that occurs frequently, and in Linux on the terminal, there are many ways to rename files. Let's look at some of the main ways you can rename your files on Linux and other Unix-based systems like MacOS.

Renaming Files With the MV Command

The mv command moves a file to another place. It can also be used to move a file to the same location, and simply change its name. For example, if you wanted to rename a file called file-1.txt to file-2.txt, you would first cd into that directory, and run the following: