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, za, zi, zq, zr)
$ zoxide init [bash|fish|zsh]
copy

SYNOPSIS

z [options] [query]

PARAMETERS

query
    The fuzzy search query for the directory. If omitted, jumps to the most recently used directory.

-h, --help
    Display help message.

-V, --version
    Show version information.

-a, --add
    Add the specified path to the database.

-i, --init
    Print initialization code for your shell.

-l, --list
    List all stored directories and their ranks.

-s, --score
    Show the score for the specified path.

-r, --remove
    Remove the specified path from the database.

-x, --exclude
    Exclude a path from being added to the database. Useful for temporary directories

DESCRIPTION

zoxide is a smarter `cd` command that remembers your frequently used directories. It allows you to quickly navigate to these directories using fuzzy matching.

Instead of manually typing long paths, you can simply type `z ` and zoxide will find the most relevant directory containing that substring based on your past usage. It keeps track of your directory visits and ranks them, ensuring the most frequently accessed directories are prioritized.

zoxide integrates seamlessly into your shell and provides a significantly faster and more efficient way to navigate your file system, especially when dealing with deeply nested or frequently visited directories.

CAVEATS

zoxide needs to be initialized in your shell's configuration file (e.g., `.bashrc`, `.zshrc`) to function correctly. You must follow the instructions provided by `zoxide --init` for your specific shell. The tool builds its internal database on your directory traversals. If you are concerned about specific directories being included, you can exclude them.

DATABASE MANAGEMENT

zoxide stores its data in a database file. You can usually find the location by running `zoxide --init`, but it is usually located in `$HOME/.zoxide`. You can manually edit this file (though it's not recommended) or use `zoxide -r` to remove entries.

SHELL INTEGRATION

zoxide provides shell integration scripts for various shells (bash, zsh, fish, etc.). You must add the output of `zoxide --init` to your shell config file to enable zoxide.

HISTORY

zoxide is a relatively modern command-line tool designed to address the limitations of the traditional `cd` command.

It was created to provide a more efficient and intuitive way to navigate the file system, especially for users who frequently work with deeply nested or frequently accessed directories. The tool gained popularity due to its fuzzy matching capabilities and its ability to learn from user behavior.

It has become a favorite alternative to `cd` for many developers and system administrators due to its speed and ease of use.

SEE ALSO

cd(1), pushd(1), popd(1)

Copied to clipboard