Skip to main content
All CollectionsLinux / SSH / Bash
Create a quick backup of a WordPress site minus the uploads via SSH
Create a quick backup of a WordPress site minus the uploads via SSH

If you need to make a quick backup of a WordPress site before doing some updates, this is for you.

Justin Catello avatar
Written by Justin Catello
Updated over 7 years ago

The one liner below will create a backup directory in the parent directory, and place the backup within a directory created using today's date.
โ€‹
One thing to note, we are excluding non needed data from this backup like the WordPress uploads folder since its not affected when you run updates to WordPress core, plugins or themes.

The database will be backed up as well.

Make sure to run this within the root directory of the WordPress install.

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)/

Did this answer your question?