Create a compressed tar backup with the date in the name
tar.gz backup with date in filename | back up website as tar.gz | compress a directory linux | quick backup before update | tar | backup | gzipCaution: This command changes the system. Understand what it does before you run it.
tar -czf /var/backups/example.com-httpdocs-$(date +%F).tar.gz -C /var/www/vhosts/example.com/httpdocs .Creates an archive such as example.com-httpdocs-2026-10-09.tar.gz. With -C PFAD . the files are stored with relative paths and can later be extracted anywhere. Owners and permissions are stored as well. Ideal as a quick backup before an update.
Note: An archive with the same name is overwritten. This does not back up the database, which needs a separate dump.
Also searched as
- tar.gz backup with date in filename
- back up website as tar.gz
- compress a directory linux
- quick backup before update