Archive and Restore your Cisco Configs
If you are used to typing "wr" to backup your configs, Cisco has been working hard at making it less easy to backup your configuration to flash. For years I've heard that write memory is "going away" and that everyone should use "copy running-config startup-config". If you are working on some newer platforms (NX-OS), you might find that wr doesn't work unless you create an alias:
alias exec wr copy run start
But there are cooler ways to backup your configurations now (aside from using third party tools), such as the Archive feature.
To backup your configs using Archive, here's a script to backup your config to disk0 once a day for two weeks:
Router(config)# archive Router(config-archive)# path disk0:backupconfig Router(config-archive)# maximum 14 Router(config-archive)# time-period 1440
If something happens to the config and you want to roll back to yesterday, that's where configure replace comes in:
Router# configure replace disk0:backupconfig-1 list time 30 Router# configure confirm
You can rollback to a specified file on your router, the "time 30" is a fail safe that will undo the rollback in 30 seconds and return you to the previous state if something goes wrong. Typing configure confirm within that time limit will keep the change.
One last thing, if you want see the last X number of commands typed on a device, Jeremy wrote a cool how to a while back. Here's a link: Configuration Change Tracking...Built in?!?
And for more detailed info on the archive and replace commands, here's a link to Cisco's official doc.