sudo tar -czf /root/backups/etc-$(date +%F).tar.gz /etc/ssh /etc/ufw /etc/fail2ban

Category: VPS Management

sudo tar -czf /root/backups/etc-$(date +%F).tar.gz /etc/ssh /etc/ufw /etc/fail2ban

Snapshot server configs before changes

Bundles the SSH, firewall, and fail2ban config trees into one compressed archive (czf = create, gzip, file) named with today's date via $(date +%F). Restoring is a tar -xzf of the same file. A five-second backup before a hardening session turns a mistake into a one-command rollback.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.