Create a timestamped backup of a file
Before editing a config, make a dated backup with a one-liner. The $(date) sub-shell appends the current timestamp.
$ cp nginx.conf nginx.conf.$(date +%Y%m%d_%H%M%S).bak
# Backup and keep last 5 only:
cp important.conf important.conf.$(date +%Y%m%d).bak
ls -t important.conf.*.bak | tail -n +6 | xargs rm -f
backupbro2026-04-19
Delete this trick? This cannot be undone.