Last Updated: February 25, 2016
· axilleas

Move/copy files the KISS way

Say you are in your home dir and you want to create a copy or rename /usr/share/icons/ridiculously/nested/shit.ico . One way is to cd into that dir and do your stuff. Another way is to repeat this whole train path twice. Third and less typing way is this:

mv /usr/share/ridiculously/nested/shit.{ico,png}

What this does is rename shit.ico to shit.png. So, the first argument in the curly braces is the extension as it was and the second as it will be.

Useful when you want to rename config files.

cp /home/thedude/my_awesome_framework/app/config.yml{.example,}

The above command copies config.yml.example to config.yml. Notice the the second argument is blank, meaning that we strip the extension .example.

This works for directories as well.