Linux Command to Rename a File or Directory

Standard Linux distributions don’t generally come with a rename command. You can install the rename package though. But the standard mv (move) command can be used to rename a file or directory very easily. The mv command will be available in almost all Linux.

We generally use the mv command to move a file or directory to a different location and name. We can rename a file or directory by simply moving that to the same location with different name.

$ mv old_file new_file

The above command will rename the old_file file to new_file.

We can rename a directory in exact same way. We have to just specify the folder name in place of the file name.

$ mv old_directory new_directory

The above command will rename the old_directory folder to new_directory.

Author: Srikanta

I write here to help the readers learn and understand computer programing, algorithms, networking, OS concepts etc. in a simple way. I have 20 years of working experience in computer networking and industrial automation.


If you also want to contribute, click here.

Leave a Reply

Your email address will not be published. Required fields are marked *

0
0
0
0
0
0