Backup files quick with Bash
Alright, here’s a quick trick that I use at least a few times a week.
Problem Let’s say we have a file that we want to make a copy of for whatever reason. In this example we’re creating a backup of the SSH server config before modifying it:
$ cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak This is fine and dandy, but a bit verbose… We’re writing the same string two times and to be frank, it’s not fun.
~/.didev