Tuesday 14 October 2014

How to rename a file in Linux

As such there is no specific command to rename file in Linux but you can use mv command to rename file in Linux.

1. Suppose you have a file name oldfile.txt and you need to reame it as newfile.txt
So the command should be
# mv oldfile.txt newfile.txt

It's just like moving file within the same directory from one name to aother.

2. In the same way you can get verbose output while renaming (moving) files. mv command will explain what is been done during the process.

mv -v oldfile.txt newfile.txt

3. You can also make mv iteractive by using -i option

mv -i oldfile.txt newfile.txt

To get the details manual of mv command type
# man mv.



No comments: