The ⌘-k "access anything" shortcut is awesome on Notion, Slack, etc.
The terminal, by comparison, is a dinosaur: tons of repeated cd and ls and TAB just to get anywhere.
This is ⌘-k for the terminal: access anything on your filesystem, from anywhere, with previews before you open:
When you press enter, selected files are identified by type and opened accordingly:
- Directories get
cdd to - Text files get opened in your
$EDITOR(orvim -Oif unset) - Images and PDFs get opened in the Preview app
.keyfiles get opened in Keynote
Note: cmdk is currently macOS-focused. File opening (Preview, Keynote,
opencommand) assumes macOS. The core navigation works on Linux, but file-open behavior may vary.
I'm extremely grateful to fzf; this project wouldn't be possible without it. I'd been fed up with terminal navigation for a decade, and fzf was the missing piece needed to make cmdk possible.
-
Install cmdk:
brew install mieubrisse/cmdk/cmdk
This installs the
cmdkbinary along with its required dependencies (fzfandfd).Optionally, install tools for richer file previews:
# For previewing text, image, and PDF files respectively brew install bat tiv poppler -
Source the shell integration. In your
.zshrcor.bashrc:eval "$(cmdk init)"
Or if you're on
fish, in your~/.config/fish/config.fish:cmdk init | source -
(Optional) Bind the
⌘-khotkey (or any other you prefer) to typecmdk+ Enter in your terminal:iTerm
Settings → Profiles → Keys → Keybindings → + → Send Text, then bind⌘-kto send the textcmdk\nGhostty
# ~/.config/ghostty/config (or $XDG_CONFIG_HOME/ghostty/config) keybind = cmd+k=text:cmdk\r -
(Optional) To use cmdk's file listing and previews with fzf's
Ctrl-T, add to your.zshrcor.bashrc:export FZF_CTRL_T_COMMAND="cmdk list-files" export FZF_CTRL_T_OPTS="-m --ansi --scheme=path --preview='cmdk preview {}'"
Or in
~/.config/fish/config.fish:set -gx FZF_CTRL_T_COMMAND "cmdk list-files" set -gx FZF_CTRL_T_OPTS "-m --ansi --scheme=path --preview='cmdk preview {}'"
-
Open a new shell and press your hotkey (⌘-K if you bound it) or type
cmdk
Press ⌘-k (or type cmdk) and...
- Type to start filtering
If you're trying to get a directory, add a
/to the end of your search term. E.g.down/will pull up theDownloadsdirectory Ctrl-jandCtrl-kto scroll up and down the results listENTERto select the resultTABto select multiple items beforeENTERCtrl-uto clear the selection
Some directories like
Library,/, and.gitare full of stuff you don't typically need to browse, so their contents are excluded. To get into them, first ⌘-k to the directory itself, then ⌘-k again to see its contents.
Sometimes you only want to navigate within the current directory. Use
cmdk -oto list only the current directory's contents (no recursing) orcmdk -sto list subdirectories (recursing). Tip: you can set up separate terminal hotkeys for these — e.g.,⌘-kforcmdk\nand⌘-shift-kforcmdk -s\n.
-o- Only list the contents of the current directory at depth 1-s- List all contents of the current directory recursively, including subdirectories
You need Go 1.25+ and the runtime dependencies installed:
brew install go fzf fd # required
brew install bat tiv poppler # optional: text, image, and PDF previewscd go/
make build # produces ./cmdk
make clean # removes the binaryOr without Make:
cd go/
go build -o cmdk .I'd love to hear how you're using cmdk, and making it your own.


