Backup
Take a consistent snapshot of your history database so you can recover from mistakes. Suvadu also snapshots automatically before any destructive delete.
Quick Start
Run suv backup to write a timestamped copy of your database into the backups directory.
suv backup
# ✓ Backed up to ~/Library/Application Support/suvadu/backups/history-20260621-091500.db (34.0 MB) Write the snapshot to a specific path with --out:
suv backup --out ~/suvadu-backup.db How It Works
Backups use SQLite's VACUUM INTO, producing a compact, internally-consistent copy even while the database is in use. The copy is written with owner-only permissions, since it contains your shell history.
Where backups live
- macOS:
~/Library/Application Support/suvadu/backups/ - Linux:
~/.local/share/suvadu/backups/
The directory is created on first use with 0700 permissions.
Automatic Backup Before Delete
Because suv delete is irreversible, Suvadu writes a snapshot to the backups directory before deleting, and aborts the delete if that snapshot fails. Skip it with --no-backup if you're sure.
suv delete "old-pattern" # backs up first, then deletes
suv delete "old-pattern" --no-backup # skip the safety snapshot Backup vs. Export
suv backup and suv export serve different purposes:
suv backup— a full, exact database snapshot for recovery. Restore by replacing your database file with the snapshot.suv export— a portable JSONL/CSV dump for moving history between machines or analysis, imported with suv import.
Restoring
To restore, replace your database file with a backup copy while no shell is actively recording:
cp ~/Library/Application\ Support/suvadu/backups/history-20260621-091500.db \
~/Library/Application\ Support/suvadu/history.db Tips
- Schedule periodic snapshots with cron:
0 9 * * * suv backup. - The backups directory accumulates snapshots over time — prune old ones manually when needed.