Linux CP Making a Backup of a file with a user defined suffix

  • Post by Mike Dixson
  • Feb 09, 2017
post-thumb

I use this handy command so often that I’d forgotten to make a note of it here for everyone.

If you want to make a copy of a file with the same filename and a predetermined suffix of your choice then run this command replaceing the YYYYMMDD date with anything you want:

cp haproxy.cfg{,.20170209}

The above command copies haproxy.cfg into a file called haproxy.cfg.20170209
Anything after the comma can be changed as you wish.

LATEST POST
  • Post By Mike Dixson
  • Nov 17, 2020
Using MFA for Sudo Only
  • Post By Mike Dixson
  • Jul 25, 2020
Fixed: Obelisk not working in Ableton Live
  • Post By Mike Dixson
  • Jun 15, 2020
BYOBU files being flagged by rkhunter
TAG