How to Back Up WordPress from the Command Line with WP-CLI

Introduction

If you manage WordPress over SSH — on a VPS, a managed host, or a fleet of client sites — clicking through the admin dashboard to run a backup quickly gets old. It’s slower, it can’t be scripted, and on a large site a browser-driven backup can stall when the tab closes or the connection drops.

The command line solves all of that. With Nota Backup & Restore, every important backup action is available through WP-CLI under the wp nota namespace. Because commands run in the shell instead of the browser, there are no request timeouts — even a multi-gigabyte site backs up in a single command. This guide walks through the whole command set, from your first backup to restores, cloud uploads, and automation.

Why Back Up WordPress from the Command Line

  • No browser timeouts — the backup runs synchronously in the shell, so even very large sites finish in one go without the 30-second PHP limit getting in the way.
  • Scriptable — drop wp nota backup into a deploy script, a cron job, or a CI/CD pipeline and back up before every change automatically.
  • Fast on many sites — managing dozens of installs? A one-line command beats logging into each dashboard by hand.
  • Reuses your settings — encryption keys, exclusion rules, and cloud credentials configured in the admin are all applied automatically, so the terminal and the dashboard stay in sync.

What You’ll Need Before You Start

  • A WordPress site with Nota Backup & Restore installed and active.
  • WP-CLI available on your server (most managed and VPS hosts include it; run wp --info to check).
  • SSH or terminal access to the site’s root directory.

Most backup commands — creating backups, listing, verifying, generating an installer — work in both the free and Pro versions. A few, noted below, are Pro-only: cloud uploads, the SQLite format, command-line restore, and scheduled-profile commands.

Step 1: Confirm the Commands Are Available

From your site’s directory, run:

wp help nota

You’ll see the full list of subcommands. For the options of any single command, add its name — for example wp help nota backup.

Step 2: Create Your First Backup

The simplest possible backup — a full archive of files and database — is one command:

wp nota backup

The archive is built on your server and listed in your backup history, exactly as if you’d run it from the dashboard. You can tailor what gets backed up with these options:

  • --type=<full|db|files> — back up everything (default), the database only, or files only.
  • --tables=<a,b,c> — limit the database dump to specific tables.
  • --exclude=<path1,path2> — skip extra paths on top of your saved exclusion rules.
  • --encrypt — force AES-256 encryption for this backup, even if it’s off in settings.
  • --notes="text" — attach a note that shows up in the history table.
  • --porcelain — output only the resulting filename, for use in scripts.

A few real-world examples:

wp nota backup --type=db --notes="Before plugin update"
wp nota backup --exclude=/wp-content/uploads/videos --encrypt
wp nota backup --porcelain

Step 3: List, Inspect, and Verify Backups

Once you have a few backups, these commands help you keep track of them:

  • wp nota list — show every backup with its ID, date, size, type, and status.
  • wp nota info <id> — show full details for a single backup.
  • wp nota status — check whether a backup is currently running, and its progress.
  • wp nota verify <id> — confirm the archive exists on disk and is readable.

Need the file itself, or a way to migrate? wp nota download <id> prints the absolute server path to the archive, and wp nota installer <id> generates the standalone installer.php for that backup. To tidy up, wp nota delete <id> removes a backup and its history record, while wp nota cleanup clears a stuck or stale backup state so a new one can start.

Step 4: Upload to the Cloud and Use the SQLite Format (Pro)

In the Pro version, you can write backups in the SQLite archive format and push them to any configured cloud destination straight from the terminal:

wp nota backup --format=sqlite
wp nota backup --upload=gdrive
wp nota backup --type=full --upload=s3 --encrypt
  • --format=<zip|sqlite> — choose the archive format. SQLite enables smaller, incremental backups — see SQLite vs ZIP for WordPress Backups.
  • --upload=<gdrive|s3|wasabi|dropbox|onedrive|ftp> — upload to a configured destination after the backup completes.

Two more cloud helpers: wp nota cloud-test <provider> verifies your credentials and connectivity, and wp nota cloud-pull lists and downloads backups stored in the cloud back to the local server.

Step 5: Restore from the Command Line (Pro)

You can restore a backup without ever opening the dashboard:

wp nota restore <id>
wp nota restore <id> --type=db

Restore overwrites your live site, so always create a fresh backup first and double-check the ID with wp nota list before you run it. If WordPress itself won’t load, the standalone installer (wp nota installer <id>) is the safer path — it restores without a working WordPress at all.

Step 6: Automate Backups with Cron and CI/CD

The real payoff of command-line backups is automation. Because wp nota backup returns cleanly and supports --porcelain, it drops neatly into a system cron job or a deployment pipeline:

# Take an encrypted DB backup to Google Drive every night at 2am
0 2 * * * cd /var/www/mysite && wp nota backup --type=db --upload=gdrive --encrypt

Running it before each deploy gives you an instant rollback point if an update goes wrong. You can also trigger your saved schedules directly: wp nota schedule-list shows your configured profiles and wp nota schedule-run <id> fires one immediately.

Using a real server cron (instead of WordPress’s visitor-triggered WP-Cron) also makes scheduled backups far more reliable — we explain why in WP-Cron Not Running? How to Make Scheduled WordPress Backups Actually Reliable.

Command Reference

The full wp nota command set, with Pro-only commands marked:

  • wp nota backup — create a backup (options above)
  • wp nota list — list all backups
  • wp nota info <id> — show backup details
  • wp nota status — show running-backup progress
  • wp nota verify <id> — check an archive is valid
  • wp nota download <id> — print the archive path
  • wp nota installer <id> — generate the standalone installer
  • wp nota delete <id> — delete a backup
  • wp nota cleanup — clear a stuck backup state
  • wp nota restore <id> — restore a backup (Pro)
  • wp nota cloud-test <provider> — test a cloud connection (Pro)
  • wp nota cloud-pull — download backups from the cloud (Pro)
  • wp nota schedule-list — list backup schedules (Pro)
  • wp nota schedule-run <id> — run a schedule now (Pro)

You’ll find the same reference, kept up to date, in the WP-CLI section of our documentation.

Troubleshooting

  • wp nota is not a registered command” — the plugin isn’t active for the site you’re targeting. Run from the site root, and on multisite add --url= for the right site.
  • wp: command not found” — WP-CLI isn’t installed or isn’t on your PATH. Check with wp --info, or ask your host whether WP-CLI is available over SSH.
  • A previous backup looks stuck — run wp nota cleanup to clear the stale state, then start again.
  • Permission or memory errors on a huge site — back up files and database separately (--type=files then --type=db), or exclude large media folders with --exclude.

Frequently Asked Questions

Do command-line backups use the same settings as the dashboard?
Yes. Encryption, exclusion rules, and cloud credentials you set in the admin are all reused automatically — a backup made with wp nota backup is identical to one started from the UI.

Is WP-CLI support available in the free version?
The core commands — creating, listing, verifying, deleting, downloading backups, and generating the installer — work in the free version. Cloud uploads, the SQLite format, command-line restore, and schedule commands are Pro features.

Will a command-line backup time out on a large site?
No. Commands run in the shell, not the browser, so they aren’t bound by the web server’s request limits. This is exactly why the command line is the best way to back up very large sites.

Can I back up automatically before every deploy?
Yes — that’s the ideal use case. Add wp nota backup to your deploy script or CI/CD pipeline, and use --porcelain to capture the resulting filename for logging or rollback.

Conclusion

The command line turns WordPress backups into something you can automate and trust: no timeouts, no clicking, and a clean fit with the tools you already use over SSH. Start with a single wp nota backup, then layer on encryption, cloud uploads, and a cron job — and your sites are protected without you ever opening the dashboard.

Back up WordPress from the terminal — on every server you run

Get cloud uploads, command-line restore, and the SQLite format with Nota Backup & Restore. Start your 14-day free trial — no credit card required.