Overview
Theprune command removes indexed chunks that belong to files that no longer exist. This helps keep the database clean and prevents search results from referencing deleted files.
Syntax
Options
Show what would be pruned without actually deleting anything. Useful for previewing the cleanup operation.
Show detailed output during the pruning process.Alias:
-lWhen to Use Prune
Runknow prune when:
- You’ve deleted or moved files outside of know
- You’ve removed directories from the watch list with
know remove - You want to clean up the database after major file reorganization
- Search results are showing paths to files that no longer exist
Examples
Prune orphaned chunks
Dry run to preview pruning
Prune with detailed logs
Dry run with logs
Pruning only removes chunks from files that no longer exist on disk. It does not remove chunks from files that still exist but were removed from the watch list.
Workflow Example
Alternative Approach
If you want to completely rebuild the index instead of pruning:See Also
know index --force- Rebuild the entire indexknow reset- Clear the entire indexknow remove- Remove directories from watch list