navi
An interactive cheatsheet tool for the command line — browse, search, and execute shell snippets without ever leaving your terminal.
navi is an interactive cheatsheet tool for the terminal. It lets you browse
through command snippets, fill in arguments interactively, and execute them —
all without leaving your shell. Think of it as a personal, searchable command
reference that actually runs the commands for you.
It ships with built-in access to community cheatsheet repositories and supports
defining your own .cheat files, making it equally useful as a learning aid for
new tools and as a productivity shortcut for commands you use regularly but can
never quite remember.
Features
- Interactive fuzzy search — type to filter through thousands of snippets;
powered by
fzforskimunder the hood - Argument completion — snippet variables become interactive prompts; navi fills in your values before running
- Community cheatsheets — integrates with cheat.sh and the tldr-pages project out of the box
- Custom cheatsheets — write
.cheatfiles in a simple format and navi picks them up automatically - Shell widget — bind navi to a key (e.g.
Ctrl+G) to trigger it inline while typing a command - Shell agnostic — works with bash, zsh, fish, and others
- Variable types — variables can be filled by running a shell command, selecting from a list, or free-form input
Installation
cargo install navi
Or via your package manager:
# Debian / Fedora
# Pre-built Linux binaries are available on the
# [releases page](https://github.com/denisidoro/navi/releases).
# macOS
brew install navi
# Arch Linux
pacman -S navi
# Nix
nix-env -iA nixpkgs.naviSetup
Shell widget
The most useful feature is the shell widget, which lets you trigger navi with a key press while composing a command. Add this to your shell config:
# bash (~/.bashrc)
eval "$(navi widget bash)"
# zsh (~/.zshrc)
eval "$(navi widget zsh)"
# fish (~/.config/fish/config.fish)
navi widget fish | source
Then press Ctrl+G at any time to open the navi search UI. The selected command
is pasted into your prompt, ready to edit or execute.
Fetch community cheatsheets
navi repo add https://github.com/denisidoro/cheats
navi repo add https://github.com/denisidoro/navi-tldr-pagesUsage
# Open the interactive browser
navi
# Search for a specific topic immediately
navi --query "docker"
# Use cheat.sh as the backend
navi --cheatsh
# Browse tldr pages
navi --tldrWriting Custom Cheatsheets
Cheatsheets are plain text files with a .cheat extension stored in
~/.local/share/navi/cheats/. The format is simple:
% git, version control
# Undo the last commit but keep changes staged
git reset --soft HEAD~1
# Undo the last commit and discard changes
git reset --hard HEAD~1
# Interactively rebase the last N commits
git rebase -i HEAD~<number_of_commits>
# Show the diff of a specific commit
git show <commit_hash>
% docker, containers
# Remove all stopped containers
docker container prune
# Tail logs for a container
docker logs -f <container_name>
# Open a shell in a running container
docker exec -it <container_name> <shell>
Variables wrapped in <angle_brackets> become interactive prompts when the
snippet is selected.
Dynamic variable completion
Variables can be populated by running a shell command:
% kubernetes, k8s
# Get logs for a pod
kubectl logs -f <pod>
$ pod: kubectl get pods --no-headers | awk '{print $1}'
When you select the snippet, navi runs kubectl get pods and presents the
output as a list for you to choose from — so <pod> is always populated with a
real, current pod name.
Tips
- Store your
.cheatfiles in a git repository and symlink them into~/.local/share/navi/cheats/to keep them backed up and in sync across machines - Use
navi --printto print the selected command instead of executing it — useful for scripting - Combine with
fzforskimfor the fastest possible fuzzy search experience