If you’re looking for a quick and efficient way to back up your WordPress website, this one-liner will do the job. The backup will be stored in a directory created with today’s date, and it will exclude unnecessary files—like the WordPress uploads folder because these files are generally unaffected by updates to WordPress core, plugins, or themes.
Additionally, the WordPress database will also be backed up. Make sure to run this within the root directory of the WordPress install.
Run this as one single command:
mkdir -p ../backup/$(date +%Y-%m-%d) ; mysqldump $(grep DB_NAME wp-config.php | grep -v WP_CACHE_KEY_SALT | cut -d \' -f 4) | gzip > ../backup/$(date +%Y-%m-%d)/db.sql.gz ; rsync -ahv --exclude 'wp-content/uploads' --exclude 'wp-content/cache' . ../backup/$(date +%Y-%m-%d)/
Once the above command is run, it will create a backup directory with today's date, compress the database into a .sql.gz
file, and sync the necessary WordPress files, excluding the uploads
and cache
folders.
Congratulations! You've successfully created a quick backup of your WordPress site via SSH, excluding the uploads folder.
If you have any questions, please don’t hesitate to contact our team via live chat.
For technical inquiries, please feel free to reach our support team by emailing support@bigscoots.com from your registered email or by submitting a support ticket.