A fast, intelligent directory navigation tool that uses the locate database to quickly find and change to directories. Features frequency tracking and an interactive TUI for easy directory selection.
ccd is a shell function that wraps a Rust tool called ccd-pick. First install ccd-pick, then use it to install the wrapper.
- Fast search: Uses the
locatedatabase for instant directory lookup - Interactive mode: Beautiful TUI interface for browsing and selecting directories
- Bookmarking: Quickly add a directory to the "frequently used" list
- Frequency tracking: Remembers and prioritizes frequently used directories selected via the TUI
- Smart sorting: Results sorted by usage frequency, then by path length
- Keyboard navigation: Full keyboard support for easy navigation
- Safe installation: Automated installer with backup and update support
- Shell integration: Properly changes the current shell's working directory
-
Install the Rust binary to your PATH:
cargo install ccd-pick
Or, to build and install from the repository:
cargo install --path . --locked -
Ensure
~/.cargo/binis in your PATH (add to ~/.bashrc if needed):export PATH="$HOME/.cargo/bin:$PATH"
-
Install the shell function to your ~/.bashrc:
ccd-pick --install
-
Reload your shell configuration:
source ~/.bashrc
The ccd-pick search functionality will only work if locate is installed and working, and the
locate index is up-to-date. It is typically provided via the plocate package, which replaces
the older mlocate, and the underlying database is usually regularly updated in the background
via the updatedb command.
If you prefer manual installation, you can get the shell function and add it manually:
# Print the shell function
ccd-pick --printfn > ccd_function.sh
# Add this to your ~/.bashrc or ~/.zshrc
source /path/to/ccd_function.sh# Launch interactive directory picker
ccdInteractive Mode Controls:
- Type to search for directories
Tab: Toggle between search mode and frequent directories view↑/↓: Navigate through resultsPgUp/PgDn: Fast navigation (10 items at a time)Home/End: Jump to first/last resultEnter: Select directory and change to itShift+Delete: Reset frequency count for selected directoryEsc: Quit without changing directory
Search Mode:
- Type to search directories using the locate database
- Results sorted by frequency, then by path length
Frequent Mode:
- Press
Tabto view your most frequently used directories - Shows directories sorted by usage count (most used first)
- Press
Tabagain to return to search mode
# Change to best match for "proj"
ccd proj
# Show help
ccd --help- Each time you select a directory in the TUI, its usage count is incremented
- If you feel lucky via
ccd <search>, the count is not incremented. This is to avoid tracking poor matches. - Frequently used directories appear at the top of search results
- You can reset frequency counts using the
Shift+Deletekey in interactive mode - Frequency data is stored in
~/.ccd_frequency
- The
ccd-pickbinary searches the locate database usinglocate --limit 100 <pattern> - Filters results to show only directories
- Loads frequency data from
~/.ccd_frequency - Sorts results by usage frequency (most used first), then by path length
- In direct mode: changes to the first directory found
- In interactive mode: presents a TUI for selection
The tool uses a shell function wrapper (ccd) that calls the Rust binary (ccd-pick) and properly changes the current shell's directory. The binary outputs the target directory path, and the shell function captures this and executes cd.
$ ccd
# Opens TUI interface - type "proj" to search
# Use arrow keys to navigate, Enter to select$ ccd tmp
Changed to: /tmp
$ ccd nonexistent
Searching for directories matching: nonexistent
No directories found matching 'nonexistent'- Rust (for building the binary)
- locate command (usually part of
plocatepackage) - Updated locate database (
sudo updatedb) - Bash (for the shell wrapper)
src/main.rs- Main Rust application (ccd-pickbinary)ccd.sh- Shell wrapper function (compiled into binary)build.rs- Build script for compiling shell functionCargo.toml- Rust project configuration
# Debug build
cargo build
# Release build
cargo build --release
# Install to ~/.cargo/bin
cargo install --path . --lockedSee AGENTS.md for contribution guidelines. We welcome contributions from both humans and AI assistants!
This project is open source. Please see the license file for details.
