Moving files with curly braces
Igor wrote this in May 2015
Did you ever had to rename a part of a relly long filename?
mv really-fake-and-really-long-file-name.html not-fake-and-really-long-file-name.html
Or rename files several directories bellow your path?
mv tips/source/posts/latest/images/dog.html tips/source/posts/latest/images/cat.html
Using some curly braces can help to ease up the pain:
mv {really,not}-fake-and-really-long-file-name.html
mv tips/source/posts/latest/images/{dog,cat}.html
It can even help you to add a suffix to your commands, and instead of creating backups with:
mv .vimrc .vimrc.backup
You can simply write:
mv .vimrc{,.backup}
and the following to reuse the backup:
mv .vimrc{.backup,}
It seems like a trivial thing, but if you spend as much time in the terminal as I do, you will start to value these simple tips and tricks that can make you job at least a little bit faster.
To learn more about this tehnique called Brace Expansion visit the bash docs.