Last Updated: February 25, 2016
·
984
· minivan

A zsh alias to quickly back up a file

Hey!
There's places where you wish you had version control, but there is none. You feel that a classical backup makes more sense, but it takes a bit of time to type and remember how to do it! (Actually, it doesn't, but it makes the tip sound at least remotely useful)

Here's a small alias I recently added to my zshrc:

bkp() {
  cp "$1"{,.bak}
}

So now you can use it by typing bkp test.txt and it will create a file named test.txt.bak in the current directory.

And that's something one can easily add to their toolbox.