CLI Reference¶
Complete command-line interface reference for BTK (Bookmark Toolkit).
Command Structure¶
BTK uses a grouped command structure:
Global Options¶
Options that apply to all commands:
--db PATH- Database file path (default:btk.dbin current directory)--version- Show version and exit--help- Show help message and exit
Examples:
# Use specific database
btk --db ~/bookmarks.db bookmark list
# Show version
btk --version
# Show help
btk --help
Command Groups¶
btk bookmark - Bookmark Operations¶
Core CRUD operations for managing bookmarks.
btk bookmark add¶
Add a new bookmark.
Syntax:
Arguments:
url- URL of the bookmark (required)
Options:
--title TEXT- Bookmark title (auto-fetched if not provided)--description TEXT- Bookmark description--tags TEXT- Comma-separated tags--stars- Mark as starred--no-fetch- Don't fetch title/content automatically
Examples:
btk bookmark add https://example.com
btk bookmark add https://example.com --title "Example Site"
btk bookmark add https://example.com --tags "python,tutorial" --stars
btk bookmark add https://example.com --no-fetch
btk bookmark list¶
List bookmarks with filtering and sorting.
Syntax:
Options:
--limit N- Limit results to N bookmarks--offset N- Skip first N bookmarks--tags TEXT- Filter by tags (comma-separated)--starred- Show only starred bookmarks--archived- Show archived bookmarks--domain TEXT- Filter by domain--sort FIELD- Sort by field (added, title, visits, etc.)--format FORMAT- Output format (table, json, csv)
Sort Fields:
added- Date added (default)title- Alphabetical by titlevisits- Visit countvisited- Last visited datestars- Starred status
Examples:
btk bookmark list
btk bookmark list --limit 20
btk bookmark list --starred --tags python
btk bookmark list --sort visits --limit 10
btk bookmark list --format json > bookmarks.json
btk bookmark search¶
Search bookmarks using full-text search.
Syntax:
Arguments:
query- Search query (required)
Options:
--tags TEXT- Filter by tags--starred- Search only starred bookmarks--in-content- Search in cached content (not just title/URL)--limit N- Limit results
Examples:
btk bookmark search "python tutorial"
btk bookmark search "machine learning" --in-content
btk bookmark search "tutorial" --tags python
btk bookmark search "important" --starred
btk bookmark get¶
Get detailed information about a specific bookmark.
Syntax:
Arguments:
id- Bookmark ID (required)
Options:
--details- Show full details including content cache--format FORMAT- Output format (table, json, yaml)
Examples:
btk bookmark update¶
Update bookmark metadata.
Syntax:
Arguments:
id- Bookmark ID (required)
Options:
--title TEXT- Update title--description TEXT- Update description--stars- Set starred status to true--no-stars- Set starred status to false--add-tags TEXT- Add tags (comma-separated)--remove-tags TEXT- Remove tags (comma-separated)--set-tags TEXT- Replace all tags
Examples:
btk bookmark update 123 --title "New Title"
btk bookmark update 123 --stars
btk bookmark update 123 --add-tags "important,featured"
btk bookmark update 123 --remove-tags "draft"
btk bookmark update 123 --set-tags "python,tutorial"
btk bookmark delete¶
Delete bookmarks from the collection.
Syntax:
Arguments:
id- One or more bookmark IDs
Options:
--filter-tags TEXT- Delete bookmarks with these tags--filter-domain TEXT- Delete bookmarks from domain--dry-run- Preview what would be deleted without deleting
Examples:
btk bookmark delete 123
btk bookmark delete 123 456 789
btk bookmark delete --filter-tags "old,deprecated"
btk bookmark delete --filter-domain "old-site.com"
btk bookmark delete --filter-tags "draft" --dry-run
btk bookmark query¶
Advanced querying using SQL-like syntax.
Syntax:
Arguments:
sql-query- SQL WHERE clause (required)
Examples:
btk bookmark query "stars = true AND visit_count > 10"
btk bookmark query "added > '2024-10-01'"
btk bookmark query "tags LIKE '%python%'"
btk bookmark query "stars = true AND (tags LIKE '%python%' OR tags LIKE '%tutorial%')"
btk tag - Tag Management¶
Commands for managing tags and tag hierarchies.
btk tag list¶
List all tags.
Syntax:
Options:
--format FORMAT- Output format (table, json, csv)
Examples:
btk tag tree¶
Show hierarchical tag tree.
Syntax:
Examples:
btk tag stats¶
Show tag usage statistics.
Syntax:
Examples:
btk tag add¶
Add tags to bookmarks.
Syntax:
Arguments:
tag- Tag name (required)id- One or more bookmark IDs
Options:
--all- Add tag to all bookmarks--starred- Add tag to all starred bookmarks--filter-tags TEXT- Add to bookmarks with these tags
Examples:
btk tag add important 123 456 789
btk tag add reviewed --starred
btk tag add needs-review --filter-tags "draft,wip"
btk tag add programming/python/advanced 123
btk tag remove¶
Remove tags from bookmarks.
Syntax:
Arguments:
tag- Tag name (required)id- One or more bookmark IDs
Options:
--all- Remove tag from all bookmarks--filter-tags TEXT- Remove from bookmarks with these tags
Examples:
btk tag rename¶
Rename a tag across all bookmarks.
Syntax:
Arguments:
old-tag- Current tag name (required)new-tag- New tag name (required)
Examples:
btk tag rename javascript js
btk tag rename programming/python/web programming/python/web-dev
btk tag rename backend programming/backend
btk tag copy¶
Copy a tag to additional bookmarks.
Syntax:
Arguments:
tag- Tag name to copy (required)
Options:
--to-ids ID [ID ...]- Copy to specific bookmark IDs--starred- Copy to all starred bookmarks--filter-tags TEXT- Copy to bookmarks with these tags
Examples:
btk tag copy featured --to-ids 123 456 789
btk tag copy high-priority --starred
btk tag copy reviewed --filter-tags "programming/python"
btk tag filter¶
Filter bookmarks by tag prefix.
Syntax:
Arguments:
prefix- Tag prefix (required)
Examples:
btk content - Content Operations¶
Manage cached webpage content.
btk content refresh¶
Fetch or refresh cached content for bookmarks.
Syntax:
Options:
--id ID- Refresh specific bookmark--all- Refresh all bookmarks--force- Force refresh even if cached--workers N- Number of parallel workers (default: 10)--starred- Refresh only starred bookmarks--filter-tags TEXT- Refresh bookmarks with tags
Examples:
btk content refresh --id 123
btk content refresh --all
btk content refresh --all --workers 50
btk content refresh --starred --force
btk content refresh --filter-tags "programming/python"
btk content view¶
View cached content for a bookmark.
Syntax:
Arguments:
id- Bookmark ID (required)
Options:
--html- Open HTML in browser--markdown- Display markdown in terminal (default)--raw- Show raw HTML
Examples:
btk content auto-tag¶
Generate tags automatically based on cached content.
Syntax:
Options:
--id ID- Auto-tag specific bookmark--all- Auto-tag all bookmarks--apply- Apply suggested tags (otherwise just preview)--threshold FLOAT- Confidence threshold (0.0-1.0, default: 0.5)--workers N- Number of parallel workers--max-tags N- Maximum tags to suggest (default: 5)
Examples:
btk content auto-tag --id 123
btk content auto-tag --all
btk content auto-tag --id 123 --apply
btk content auto-tag --all --apply --threshold 0.7 --workers 20
btk import - Import Operations¶
Import bookmarks from various formats.
btk import html¶
Import bookmarks from HTML (Netscape Bookmark Format).
Syntax:
Arguments:
file- HTML file path (required)
Options:
--add-tags TEXT- Add tags to all imported bookmarks--skip-duplicates- Skip bookmarks that already exist
Examples:
btk import html bookmarks.html
btk import html bookmarks.html --add-tags "imported,firefox"
btk import html bookmarks.html --skip-duplicates
btk import json¶
Import from JSON format.
Syntax:
Arguments:
file- JSON file path (required)
Options:
--add-tags TEXT- Add tags to all imported bookmarks--skip-duplicates- Skip bookmarks that already exist
Examples:
btk import csv¶
Import from CSV file.
Syntax:
Arguments:
file- CSV file path (required)
Options:
--add-tags TEXT- Add tags to all imported bookmarks--skip-duplicates- Skip bookmarks that already exist
CSV Format:
Examples:
btk import text¶
Import plain text file with URLs (one per line).
Syntax:
Arguments:
file- Text file path (required)
Options:
--add-tags TEXT- Tags for all imported bookmarks--fetch-titles/--no-fetch-titles- Fetch titles from URLs (default: true)
Examples:
btk import text urls.txt
btk import text urls.txt --no-fetch-titles
btk import text urls.txt --add-tags "reading-list,2024"
btk import chrome¶
Import directly from Chrome browser.
Syntax:
Options:
--profile TEXT- Browser profile name--add-tags TEXT- Tags for imported bookmarks
Examples:
btk import chrome
btk import chrome --profile "Profile 1"
btk import chrome --add-tags "chrome,browser"
btk import firefox¶
Import directly from Firefox browser.
Syntax:
Options:
--profile TEXT- Browser profile name--add-tags TEXT- Tags for imported bookmarks
Examples:
btk import firefox
btk import firefox --profile work
btk import firefox --add-tags "firefox,browser"
btk import safari¶
Import directly from Safari browser.
Syntax:
Options:
--add-tags TEXT- Tags for imported bookmarks
Examples:
btk export - Export Operations¶
Export bookmarks to various formats.
btk export html¶
Export to browser-compatible HTML.
Syntax:
Arguments:
output-file- Output file path (required)
Options:
--hierarchical- Create folder hierarchy from tags--starred- Export only starred bookmarks--filter-tags TEXT- Export bookmarks with tags--include-archived- Include archived bookmarks
Examples:
btk export html bookmarks.html
btk export html bookmarks.html --hierarchical
btk export html starred.html --starred
btk export html python.html --filter-tags "programming/python"
btk export json¶
Export to JSON format.
Syntax:
Arguments:
output-file- Output file path (required)
Options:
--starred- Export only starred bookmarks--filter-tags TEXT- Export bookmarks with tags--include-archived- Include archived bookmarks
Examples:
btk export json bookmarks.json
btk export json starred.json --starred
btk export json python.json --filter-tags "python"
btk export csv¶
Export to CSV format.
Syntax:
Arguments:
output-file- Output file path (required)
Options:
--starred- Export only starred bookmarks--filter-tags TEXT- Export bookmarks with tags--include-archived- Include archived bookmarks
Examples:
btk export markdown¶
Export to Markdown format.
Syntax:
Arguments:
output-file- Output file path (required)
Options:
--starred- Export only starred bookmarks--filter-tags TEXT- Export bookmarks with tags--include-archived- Include archived bookmarks
Examples:
btk db - Database Management¶
Database maintenance and information commands.
btk db info¶
Show database statistics and information.
Syntax:
Examples:
btk db schema¶
Display database schema.
Syntax:
Examples:
btk db stats¶
Show detailed database statistics.
Syntax:
Options:
--tags- Tag statistics--domains- Domain statistics--activity- Activity statistics
Examples:
btk db vacuum¶
Optimize database file.
Syntax:
Examples:
btk db dedupe¶
Find and handle duplicate bookmarks.
Syntax:
Options:
--strategy TEXT- Deduplication strategy:merge- Merge duplicate metadatakeep_first- Keep oldest bookmarkkeep_last- Keep newest bookmarkkeep_most_visited- Keep most visited bookmark--preview- Preview changes without applying--stats- Show duplicate statistics only
Examples:
btk db dedupe --preview
btk db dedupe --stats
btk db dedupe --strategy merge
btk db dedupe --strategy keep_first
btk graph - Graph Analysis¶
Build and analyze bookmark relationship graphs.
btk graph build¶
Build bookmark similarity graph.
Syntax:
Options:
--tag-weight FLOAT- Weight for tag similarity (default: 1.0)--domain-weight FLOAT- Weight for domain similarity (default: 1.0)--link-weight FLOAT- Weight for direct links (default: 2.0)--min-edge-weight FLOAT- Minimum edge weight to include
Examples:
btk graph build
btk graph build --tag-weight 2.0 --domain-weight 1.0
btk graph build --min-edge-weight 4.0
btk graph neighbors¶
Find similar bookmarks (neighbors in graph).
Syntax:
Arguments:
id- Bookmark ID (required)
Options:
--limit N- Limit number of results (default: 10)--min-weight FLOAT- Minimum edge weight
Examples:
btk graph export¶
Export graph data for visualization.
Syntax:
Arguments:
output-file- Output file path (required)
Options:
--format FORMAT- Export format:gexf- GEXF format (Gephi)graphml- GraphML format (yEd)json- JSON format (Cytoscape)d3- D3.js HTML visualization--min-weight FLOAT- Minimum edge weight to include
Examples:
btk graph export graph.gexf --format gexf
btk graph export graph.graphml --format graphml
btk graph export graph.json --format json
btk graph export viz.html --format d3
btk graph export graph.gexf --min-weight 4.0
btk graph stats¶
Show graph statistics.
Syntax:
Examples:
btk config - Configuration¶
Manage BTK configuration.
btk config show¶
Display current configuration.
Syntax:
Examples:
btk config set¶
Set configuration value.
Syntax:
Arguments:
key- Configuration key (required)value- Configuration value (required)
Configuration Keys:
database.path- Default database pathoutput.format- Default output format (table, json, csv)output.colors- Enable colors (true, false)import.fetch_titles- Fetch titles when importing (true, false)import.skip_duplicates- Skip duplicates when importing (true, false)content.workers- Number of parallel workers for content operationscontent.cache_expiry_days- Days before content cache expires
Examples:
btk config set database.path ~/bookmarks.db
btk config set output.format json
btk config set output.colors true
btk config set content.workers 50
btk config init¶
Initialize default configuration file.
Syntax:
Examples:
Configuration File Location:
- Linux/macOS:
~/.config/btk/config.toml - Windows:
%APPDATA%\btk\config.toml
btk shell - Interactive Shell¶
Launch the interactive shell.
Syntax:
Options:
--db PATH- Database path
Examples:
See the Shell Guide for complete shell documentation.
Exit Codes¶
BTK returns standard exit codes:
0- Success1- General error2- Invalid arguments3- Database error4- Network error5- File I/O error
Environment Variables¶
BTK respects the following environment variables:
BTK_DB- Default database path (overridden by--dbflag)BTK_CONFIG- Configuration file pathNO_COLOR- Disable colored output if set
Examples:
# Set default database
export BTK_DB=~/bookmarks.db
btk bookmark list
# Disable colors
NO_COLOR=1 btk bookmark list
Configuration File¶
BTK uses TOML format for configuration:
[database]
path = "/home/user/bookmarks.db"
[output]
format = "table"
colors = true
[import]
fetch_titles = true
skip_duplicates = false
[content]
workers = 10
cache_expiry_days = 30
[graph]
tag_weight = 1.0
domain_weight = 1.0
link_weight = 2.0
See Also¶
- Shell Guide - Interactive shell reference
- Commands Guide - Command examples and workflows
- Tags Guide - Tag management strategies
- Quick Start - Getting started guide