WP Staging CLI provides commands to inspect backup files without extracting them. This is useful for verifying backup contents, checking backup metadata, and understanding what’s inside a backup before extraction.
Available Inspection Commands
| Command | Alias | Description |
|---|---|---|
dump-header | dh | View backup format and version information |
dump-metadata | dm | View backup creation details and site information |
dump-index | di | View list of files in the backup |
View Backup Header
The header contains basic information about the backup format:
wpstaging dump-header backup.wpstgOr use the short alias:
wpstaging dh backup.wpstgExample output:
Backup Header Information
-------------------------
Format Version: v2
Compression: gzip
Created By: WP STAGING Pro 5.xThis helps you verify:
- The backup file is valid
- The format version (v1 or v2)
- What tool created the backup
View Backup Metadata
The metadata contains detailed information about the backup and the source site:
wpstaging dump-metadata backup.wpstgOr use the short alias:
wpstaging dm backup.wpstgExample output:
Backup Metadata
---------------
Site URL: https://example.com
Site Name: My WordPress Site
WordPress Version: 6.4.2
PHP Version: 8.1.27
Database Prefix: wp_
Backup Date: 2024-01-15 14:30:00 UTC
Backup Size: 1.2 GB
Files Count: 15,432
Is Multisite: NoThis information is useful for:
- Verifying you have the correct backup
- Checking the original site URL before restoration
- Understanding the WordPress and PHP versions used
- Knowing the database prefix for configuration
View File Index
The file index shows all files included in the backup:
wpstaging dump-index backup.wpstgOr use the short alias:
wpstaging di backup.wpstgExample output:
File Index
----------
wp-config.php
wp-content/themes/twentytwentyfour/style.css
wp-content/themes/twentytwentyfour/functions.php
wp-content/plugins/wp-staging-pro/wp-staging-pro.php
wp-content/uploads/2024/01/image.jpg
...
Total: 15,432 filesView Detailed Index Data
For more detailed information including file sizes and offsets, use the --data flag:
wpstaging dump-index --data backup.wpstgExample output:
File Index (Detailed)
---------------------
Path Size Offset Chunks
wp-config.php 3,245 1024 1
wp-content/themes/twentytwentyfour/style.css 45,678 4,269 1
wp-content/uploads/2024/01/large-image.jpg 5,234,567 50,000 3
...The detailed view shows:
- Path: File path relative to WordPress root
- Size: Original file size in bytes
- Offset: Position in the backup file
- Chunks: Number of data chunks (large files are split)
Use Cases
Verify Backup Before Restoration
Before restoring a backup, check its contents:
# Check it's the right site
wpstaging dm backup.wpstg
# Verify specific files are included
wpstaging di backup.wpstg | grep wp-config.php
wpstaging di backup.wpstg | grep "my-custom-plugin"Identify Backup Date and Source
When you have multiple backup files and need to identify them:
# Check each backup's metadata
wpstaging dm backup-2024-01-15.wpstg
wpstaging dm backup-2024-01-20.wpstgCheck for Specific Files
Verify that specific files are included before extraction:
# Check if database file is included
wpstaging di backup.wpstg | grep "\.sql"
# Check for specific plugin
wpstaging di backup.wpstg | grep "woocommerce"
# Check for uploads
wpstaging di backup.wpstg | grep "wp-content/uploads" | head -20Troubleshoot Backup Issues
If extraction fails, use these commands to diagnose:
# Verify backup is valid
wpstaging dh backup.wpstg
# Check if metadata is readable
wpstaging dm backup.wpstg
# Verify file index is intact
wpstaging di backup.wpstgOutput Directory Option
All inspection commands support the --outputdir flag for temporary files:
wpstaging dump-metadata --outputdir=/tmp/wpstaging backup.wpstgUnderstanding Backup Structure
WP Staging backups use a proprietary format with these components:
- Header: Version identifier and format information
- Metadata: PHP serialized backup information (creation date, site info, etc.)
- File Index: Compressed list of files with paths, sizes, and chunk offsets
- File Data: Chunked and compressed file contents
The inspection commands parse these sections without extracting the full backup, making them fast even for large backups.
Next Steps
- Extract Backup Files – Extract the backup contents
- Restore WordPress from Backup – Full site restoration
- Create a Local Copy of WordPress Site – Docker-based local environment