Rename Or Copy Files Not In Current Directory

Posted on September 13, 2007 in Linux

I often catched myself renaming a file in some other directory like this:

mv some/dir/some/file some/dir/somefile_renamed

But there is an easier way:

mv some/dir/some/{file,file_renamed}

This also works for copying:

cp /etc/mail/{,}

Or vimdiff:

vimdiff /etc/mail/{,}

And thats why I love zsh so much, you can even tabcomplete after the {, try that in bash f.e. :) Be creative, I'm sure there are many useful fields of application.