WRITELOOP

HOW I USE NAVI FOR CLI CHEATSHEETS

I am a heavy cli user since my early linux days on 1998, and the amount of tools I use have grown ever since so that it is hard to know the syntax of everything by mind. Some years ago I have discovered [navi](https://github.com/denisidoro/navi/tree/master/docs), which is a cli tool that helps with creating cheatsheets for commands and parameters that I use and which is great to help me categorize and add some small descriptions to what a command does and its params. It is a simple but very useful tool that I have even integrated to my bash shell configuration to be summoned whenever I need a specific command or a set of params that will help me achieve a specific result. Here are the instructions to installing it on a Linux machine using rustup/cargo.

2026 May 13

How can this tool help you?

The commands I use daily (git, ls, cd, grep) are burned into muscle memory. But the ones I reach for once every three months? Like that specific ffmpeg incantation to trim a video, or the exact du flags to get human-readable disk usage sorted by size. I would always end up on Google (or, more recently, asking the AI) just to get the flags right.

A few years ago I stumbled upon navi. It is an interactive cheatsheet tool for the command line, written in Rust. You write your own cheat files and navi shows them through fzf, letting you fuzzy-find the command you need. It also supports variables, so you can template commands and fill in the blanks interactively.

The project sits at 17k+ stars on GitHub. It needs fzf (or skim as an alternative) and is available on Arch through pacman -S navi, but I prefer to install it via cargo since I already have the Rust toolchain.

Here you can see it in action: https://asciinema.org/a/406461

Here you can find my own cheatsheets, collected through the years: https://github.com/tiagoprn/devops/tree/master/cheats (the *.cheat files are used my navi, the other folders I use with another tool named “television”).

And below is how I set it up.

Requirements

  • fzf installed on your system
  • rustup and cargo installed

Check if you have fzf:

fzf --version

If not, install it. On Arch-based distros:

sudo pacman -S fzf

On Debian/Ubuntu:

sudo apt install fzf

Installing navi

The easiest way to keep navi updated is through cargo:

cargo install navi

This compiles from source and puts the binary at ~/.cargo/bin/navi. Make sure that directory is in your PATH:

# Add this to ~/.bashrc or ~/.zshrc if not already there
export PATH="$HOME/.cargo/bin:$PATH"

Creating your first cheatsheet

Navi uses .cheat files. The syntax is straightforward. Create a directory:

mkdir -p ~/.config/navi/cheats

Then create a file, say ~/.config/navi/cheats/utils.cheat:

% disk, storage

# Show disk usage in human-readable format, sorted by size
du -sh <dir> | sort -h

# Show disk usage of top-level directories only
du -sh -- */ | sort -h

The % line defines the category (used for filtering). Lines starting with # describe the command. The bare lines below are the actual commands. Things like <dir> become text inputs when you select the command.

Binding navi to a key

The real power is binding navi to a keyboard shortcut. I use Ctrl+G. Add this to your ~/.bashrc:


# NOTE: below enables using 'CTRL+G' to call navi in INSERT MODE
#       and make its' commands to appear on the shell history:
#       https://github.com/denisidoro/navi/issues/462
export NAVI_PATH="$NAVI_PATH:/storage/src/devops/cheats:/here/is/another/folder/with/cheatsheets"
eval "$(navi widget bash)"

Now when I press Ctrl+G, navi opens. I start typing to filter, pick the command, fill in the blanks, and the full command lands on my prompt.

Verify the setup is correct

# Navi should be available
navi --version

# Open navi interactively (press Ctrl+G or run)
navi

# Check that cargo installed it
which navi

When you run navi or press Ctrl+G, you get a fuzzy search interface. Type to filter, select, and the command appears on your terminal ready to run.

Important notes

  • Navi also supports variable expansions, so you can provide a list of options for a variable instead of typing manually. For example, $ dir: find /home -maxdepth 1 -type d would let you pick from actual directories.
  • You can load community cheatsheets by adding repositories to navi’s config. See the official docs for details.
  • If you use skim instead of fzf, pass --fzf-override skim or set it as your default.
  • The --print flag used in the keybinding above makes navi output the command to stdout instead of executing it directly.