LinuxCommandLibrary

zoxide

Quickly navigate to frequently used directories

TLDR

Go to the highest-ranked directory that contains "foo" in the name

$ zoxide query [foo]
copy

Go to the highest-ranked directory that contains "foo" and then "bar"
$ zoxide query [foo] [bar]
copy

Start an interactive directory search (requires fzf)
$ zoxide query --interactive
copy

Add a directory or increment its rank
$ zoxide add [path/to/directory]
copy

Remove a directory from zoxide's database
$ zoxide remove [path/to/directory]
copy

Generate shell configuration for command aliases (z, zi)
$ zoxide init [bash|elvish|fish|nushell|posix|powershell|tcsh|xonsh|zsh]
copy

SYNOPSIS

zoxide [OPTIONS] [QUERY]
zoxide COMMAND [OPTIONS] [ARGUMENTS]

Common aliases: z [QUERY], zi [QUERY]

PARAMETERS

--help
    Show help information for the command or subcommand.

--version
    Print the version of zoxide.

zoxide query (alias: z)
    Jump to a directory matching the query. This is the primary interactive command.

-i, --interactive
    (query) Perform an interactive fuzzy search using fzf or skim. Requires one of these tools to be installed.

-l, --list
    (query) List all matching directories without changing the current directory.

-s, --score
    (query, ls) Show the score of each directory in the output.

-t, --type
    (query) Filter results by type (e.g., 'dir' for directories). Not commonly used directly.

zoxide init <SHELL>
    Generate the shell integration script for the specified shell (e.g., bash, zsh, fish).

--cmd <ALIAS>
    (init) Set a custom alias for the zoxide query command (default: z).

--hook <HOOK_TYPE>
    (init) Choose when to update the database. Options include prompt (default), pwd, none.

--no-aliases
    (init) Prevent zoxide from creating the z and zi aliases.

--fallback
    (init) Add a fallback mechanism to cd if zoxide cannot find a match.

--no-cd
    (init) Do not cd into a directory after a successful jump (useful for scripting).

--za
    (init) Enable the za alias for zoxide add.

zoxide add <PATH>
    Add a specific path to the zoxide database manually. Usually not needed as zoxide learns automatically.

zoxide remove <PATH>
    Remove a specific path from the zoxide database.

zoxide ls
    List all directories currently stored in the zoxide database.

zoxide help [COMMAND]
    Show help information for zoxide or a specific subcommand.

DESCRIPTION

zoxide is a modern, cross-shell cd replacement that learns your most used directories based on your navigation patterns. It allows you to jump to any directory with just a few keystrokes by using a fuzzy search algorithm. Instead of typing out long paths, you can simply type a partial name or a few characters, and zoxide will intelligently find the best match and navigate you there.

It maintains a database of your frequently visited directories, along with a 'score' for each, which increases with more frequent or recent visits. This makes subsequent jumps to popular locations even quicker and more accurate. zoxide integrates seamlessly with popular shells like Bash, Zsh, Fish, Nushell, and others, offering a highly ergonomic way to traverse your filesystem, significantly enhancing command-line productivity.

CAVEATS

For interactive fuzzy search (using zi or z -i), zoxide requires an external fuzzy finder like fzf or skim to be installed and available in your PATH. If these are not present, the interactive mode will not function, though the direct fuzzy search (z query) will still work.

SHELL INTEGRATION

To use zoxide, you must initialize it in your shell's configuration file (e.g., .bashrc, .zshrc, config.fish). This is done by adding the line: eval "$(zoxide init <SHELL_NAME>)". Replace <SHELL_NAME> with your shell (e.g., bash, zsh, fish). This command sets up necessary functions and aliases, like the common z alias.

ALIASES

By default, zoxide creates two main aliases for convenience:

  • z: An alias for zoxide query. This is the primary command used for fuzzy searching and jumping to directories (e.g., z dev).
  • zi: An alias for zoxide query --interactive. This opens an interactive fuzzy finder (like fzf) to select a directory (e.g., zi).
These aliases significantly reduce typing and improve workflow efficiency.

HISTORY

zoxide was created by alecthomas as a modern, Rust-based alternative to similar tools like autojump and fasd. It was designed to be faster, more robust, and easier to integrate across different shells. Its development focused on performance and a minimalist approach, quickly gaining popularity in the command-line utility space since its inception.

SEE ALSO

cd(1), autojump(1), fasd(1), fzf(1), skim(1)

Copied to clipboard