How to rename a file inside a folder using a shell command?

Posted by Leonid Shevtsov on Super User See other posts from Super User or by Leonid Shevtsov
Published on 2012-10-12T15:33:27Z Indexed on 2012/10/12 15:40 UTC
Read the original article Hit count: 218

Filed under:
|
|

I have a file at some/long/path/to/file/myfiel.txt.

I want to rename it to some/long/path/to/file/myfile.txt.

Currently I do it by

mv some/long/path/to/file/myfiel.txt some/long/path/to/file/myfile.txt

, but typing the path twice isn't terribly effective (even with tab completion).

How can I do this faster? (I think I can write a function to change the filename segment only, but that's plan B).

© Super User or respective owner

Related posts about unix

Related posts about shell