Command-line tools for managing your zoxide database.
-
Export Your Data: Save your zoxide data in csv or other formats for portability or backup use.
-
Bulk Editing: Manage your data the way you want. Create and delete entries as you see fit.
-
Modify Scoring: Set frecency scores to levels you decide.
-
Backup/Restore: Versioned database backups with safe restore functionality on failed imports
-
Flexible Processing: Merge or replace.
# 1. Export your zoxide data to CSV for editing
./zoxide-datatools.sh export
# 2. Edit zoxide-data.csv in Excel, Google Sheets, Numbers, etc.
# 3. Import your changes back
./zoxide-datatools.sh import
# Export zoxide database to CSV for editing
./zoxide-datatools.sh export [--simple|--keep-uri|--sort] [filename]
# Import edited CSV back to zoxide
./zoxide-datatools.sh import [--merge|--replace] [--dry-run] [filename]
# Database backup and restore
./zoxide-datatools.sh backup # Create backup
./zoxide-datatools.sh restore # Restore from backup
# Direct format conversions
./zoxide-datatools.sh getzoxide output.txt [keywords...] # Export raw data
./zoxide-datatools.sh tosimplecsv input.txt output.csv # Convert to simple CSV
./zoxide-datatools.sh tocsv input.txt output.csv # Convert to full CSV
./zoxide-datatools.sh totext input.csv output.txt # CSV to zoxide format
./zoxide-datatools.sh toz input.txt output.z # Convert to z-shell format
./zoxide-datatools.sh sort input.txt output.txt # Sort hierarchically
# Advanced import (any format)
./zoxide-datatools.sh import-file [--dry-run] [--merge|--replace] filename
5.0 /Users/foo/.local/zoxide
12.5 /Users/foo/.local
26.0 /Users/foo
26.0 /Users/foo
12.5 /Users/foo/.local
5.0 /Users/foo/.local/zoxide
"5.0","/Users/foo/.local/zoxide"
"12.5","/Users/foo/.local"
"26.0","/Users/foo"
"5.0","Users","foo",".local","zoxide"
"12.5","Users","foo",".local"
"104.0","Users","foo"
/Users/foo/.local/zoxide|20|1
/Users/foo/.local|50|1
/Users/foo|64|1
# Export your zoxide database for editing
./zoxide-datatools.sh export
# Creates zoxide-data.csv with full path information
# Edit zoxide-data.csv in your favorite spreadsheet app
# - Adjust scores
# - Remove unwanted paths
# - Add new paths
# Import your changes back
./zoxide-datatools.sh import
# Automatically detects format and safely imports
# Export with simple format (just score and path)
./zoxide-datatools.sh export --simple
# Export to custom filename
./zoxide-datatools.sh export my-zoxide-data.csv
# Export simple format to custom file
./zoxide-datatools.sh export --simple simple-data.csv
# Preview changes before importing
./zoxide-datatools.sh import --dry-run
# Replace entire database (removes paths not in file)
./zoxide-datatools.sh import --replace
# Import from custom file
./zoxide-datatools.sh import my-data.csv
# Import with specific mode
./zoxide-datatools.sh import --merge --dry-run custom.csv
# Manual backup before major changes
./zoxide-datatools.sh backup
# Preview what will change
./zoxide-datatools.sh import --dry-run my-data.csv
# If something goes wrong, restore easily
./zoxide-datatools.sh restore
# Export only paths containing "project" (uses advanced commands)
./zoxide-datatools.sh getzoxide project-paths.txt project
./zoxide-datatools.sh export project-data.csv
The import system automatically detects and handles:
- Full CSV:
"score","/path","seg1","seg2",...
(exported byexport
command) - Simple CSV:
"score","/path"
(exported byexport --simple
command) - Autojump format:
score<TAB>path
(native zoxide export format) - Z format:
path|score|timestamp
(z-shell compatibility)
--merge
(default): Add/update entries, keep existing data--replace
: Replace entire database with import data--dry-run
: Preview changes without modifying database
- Automatic backups before every import
- Format validation with helpful error messages
- Auto-rollback if import fails
- Preview mode to see changes before applying
The backup system automatically preserves existing backups:
db.zo.backup
- Most recent backupdb.zo.backup.20240804_143022
- Previous backups with timestampsdb.zo.backup.20240803_091500
- Older backups preserved
Backups are stored in $_ZO_DATA_DIR
(defaults to ~/.local/share/zoxide
).
- Simple CSV/Native: Preserves original floating-point scores
- Z-format: Multiplies scores by 4 and converts to integers (zoxide compatibility requirement)
- Import handling: Z format clears database first to prevent score doubling
- Simple CSV: Just score and full path (most user-friendly)
- Full CSV mode: Splits paths into directory segments for advanced spreadsheet manipulation
- URI preservation:
--keep-uri
flag maintains full paths alongside segments - Hierarchical sorting: Orders entries by directory depth, then alphabetically
$_ZO_DATA_DIR
: Zoxide data directory (default:~/.local/share/zoxide
)
Run the comprehensive test suite:
# Test with default script
./zoxide-datatools-tests.sh
# Test with specific script version
./zoxide-datatools-tests.sh zoxide-datatools-backup.sh
- Bash 4.0+
- zoxide installed and configured
- Standard Unix utilities (awk, sort, date)
- Clone or download
zoxide-datatools.sh
- Make executable:
chmod +x zoxide-datatools.sh
- Test it works:
./zoxide-datatools.sh export --help
# Your first export/import cycle
./zoxide-datatools.sh export # Creates zoxide-data.csv
# Edit the CSV file in your favorite spreadsheet app
./zoxide-datatools.sh import # Imports your changes
# View all available commands
./zoxide-datatools.sh --help
This tool is designed to work with zoxide. See zoxide's license for details.