Suppose I want to rename a file several directories down. I do,
mv dirA/dirB/dirC/name.suf dirA/dirB/dirC/newname.suf
Is there any easier way to type this? One option would be
cd dirA/dirB/dirC
mv name.suf newname.suf
cd -
Anything better?
Suppose I want to rename a file several directories down. I do,
mv dirA/dirB/dirC/name.suf dirA/dirB/dirC/newname.suf
Is there any easier way to type this? One option would be
cd dirA/dirB/dirC
mv name.suf newname.suf
cd -
Anything better?
Depending on your shell, you could make use of the filename expansion features. In ZSH (and, I believe Bash, too), you could run
mv dirA/dirB/dirC/{name,newname}.suf
which expands to
mv dirA/dirB/dirC/name.suf dirA/dirB/dirC/newname.suf
bevore executing the mv
command (see zshexpn(1)).
dpkg-query -l 'zsh*'
)