A terminal directory picker with fuzzy search. Prints the selected path to stdout — designed to pair with cd via a shell wrapper.
select-directory --prefix <path> [--search-depth <n>] [--disable-recent]
| Flag | Default | Description |
|---|---|---|
--prefix |
required | Root directory to scan |
--search-depth |
1 | Levels deep to scan (1 = direct children) |
--disable-recent |
false | Disable recent-history priority |
| Key | Action |
|---|---|
| Type | Filter directories (fuzzy match) |
be/abc |
Search within be/ for abc |
| Ctrl+N / ↓ | Move down |
| Ctrl+P / ↑ | Move up |
| Enter | Select |
| Esc / Ctrl+C | Cancel (outputs empty string) |
Add to ~/.zshrc or ~/.bashrc:
function sd() {
local dir
dir=$(select-directory --prefix "${1:-$HOME}")
[[ -n "$dir" ]] && cd "$dir"
}Usage: sd ~/projects or sd (searches from $HOME).
Recently visited directories are stored in ~/.config/select-directory/history (max 200 entries). Use --disable-recent to sort purely alphabetically.