At the command line, lets say my pwd
is something like:
/home/whatever
And there is a file in some deep directory that I want to rename. Normally I would do this:
# mv /var/some/deep/folder/structure/fileA /var/some/deep/folder/structure/fileB
What question is, are there any command line tricks to rename a file/dir without having to type out the entire directory structure again? Something like:
# mv /var/some/deep/folder/structure/fileA fileB
The problem with that command is that it moves fileA to your pwd
. Obviously I want to keep it in the same location and simply rename it. So as I said, are there any tricks to achieve this without having to type out the entire directory structure again? It's simply a question out of curiosity and laziness.
Best Answer
Depends on your shell. In zsh you can:
If you're using bash, consider migrating to zsh - it's a pretty straightforward process and I'm sure you'll love zsh. :)
Edit:
It seems to work in bash, see Lunar_Lamp's comment.