Delete & Cleanup

Remove sensitive or unwanted commands from your history and keep your database lean with garbage collection and vacuuming.

Deleting Commands

Use suv delete to bulk-delete commands that match a given pattern. By default the pattern is matched as a substring against every command in your history.

suv delete <PATTERN>

Suvadu will show you how many commands match and ask for confirmation before deleting. Use --dry-run to preview without deleting, or -y to skip the confirmation prompt.

Flags

Flag Description
--regex Treat the pattern as a regular expression instead of a plain substring match.
--dry-run Show which commands would be deleted without actually removing them. Always recommended as a first step.
-y, --yes Skip the interactive confirmation prompt and delete immediately. Use with caution.
--before <DATE> Only delete commands recorded before the specified date or relative time (e.g., "30 days ago", "2024-01-01").

Examples

# Preview which commands contain "secret"
suv delete "secret" --dry-run

# Delete all commands starting with "test" that are older than 30 days
suv delete "^test" --regex --before "30 days ago" -y

# Delete commands containing a specific token
suv delete "ghp_abc123" -y

# Remove all curl commands from before 2024
suv delete "curl" --before "2024-01-01"

Deleting from the Search TUI

While browsing your history in the interactive search interface (suv search or Ctrl+R), you can delete individual entries on the spot:

  • Navigate to the command you want to remove.
  • Press Ctrl+D to delete it.
  • Suvadu will ask for confirmation before removing the entry.

This is useful for one-off removals — for bulk operations, use suv delete from the command line.

Garbage Collection

Over time, deleting commands can leave orphaned metadata (tags, notes, or session references that no longer point to any command). Use suv gc to clean these up.

suv gc

Flags

Flag Description
--dry-run Show what would be cleaned up without making any changes.
--vacuum After garbage collection, run SQLite's VACUUM command to compact the database file and reclaim disk space.

Examples

# Preview orphaned data
suv gc --dry-run

# Clean up and compact the database
suv gc --vacuum

Secrets Protection

Suvadu automatically redacts common secret patterns — API keys, tokens, passwords, and credentials — before writing commands to the database. This happens at capture time, so most sensitive data never reaches disk.

However, if something slipped through (an unusual token format, a password passed inline, or a secret in a non-standard flag), use suv delete to remove it:

# Find and remove commands containing a leaked secret
suv delete "sk-proj-abc123" --dry-run
suv delete "sk-proj-abc123" -y
Important: Deletions are permanent. There is no undo. Always use --dry-run first to verify the match before committing. Consider exporting a backup before bulk deletions.

Recommended Workflow

  1. Preview first — always run with --dry-run to see what will be deleted.
  2. Delete — once you have verified the matches, run without --dry-run.
  3. Garbage collect — run suv gc to clean up any orphaned data left behind.
  4. Compact — optionally run suv gc --vacuum to reclaim disk space from the SQLite file.
Tip: If you regularly work with secrets, review Settings to configure additional redaction patterns so they are caught automatically at capture time.