Yazi File Manager Setup

Yazi File Manager Setup

Yazi is a terminal file manager written in Rust. It is fast, keyboard-driven, and works well as a lightweight replacement for opening a full GUI file manager when working inside a terminal or SSH session.

This note records a minimal Linux setup: install the standalone binary and add a shell wrapper so that exiting Yazi can change the current shell directory.

Installation

Download the latest musl build from the official release page:

1
wget https://github.com/sxyazi/yazi/releases/latest/download/yazi-x86_64-unknown-linux-musl.zip

Extract it:

1
2
unar yazi-x86_64-unknown-linux-musl.zip
cd yazi-x86_64-unknown-linux-musl

Install both binaries into a directory in $PATH:

1
sudo mv yazi ya /usr/local/bin/

Check that it works:

1
2
yazi --version
ya --version

Shell Wrapper

By default, a terminal file manager cannot directly change the parent shell's current directory. Yazi solves this by writing the final directory to a temporary file. A shell function can read that file after Yazi exits and then cd there.

Add this function to .bashrc, .zshrc, or the shell config you use:

1
2
3
4
5
6
7
function y() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
command yazi "$@" --cwd-file="$tmp"
IFS= read -r -d '' cwd < "$tmp"
[ "$cwd" != "$PWD" ] && [ -d "$cwd" ] && builtin cd -- "$cwd"
rm -f -- "$tmp"
}

Reload the shell configuration:

1
source ~/.zshrc

For Bash, use:

1
source ~/.bashrc

Now start Yazi with:

1
y

When you quit Yazi, the terminal will stay in the directory you were viewing.

Notes

  • yazi is the file manager itself.
  • ya is Yazi's helper command, used for package/plugin management and integrations.
  • The musl build is convenient because it is mostly self-contained and works on many Linux distributions.
  • If sudo mv fails, make sure /usr/local/bin exists and is included in $PATH.

Update

To update, download the latest release again and replace the old yazi and ya binaries:

1
2
3
4
wget https://github.com/sxyazi/yazi/releases/latest/download/yazi-x86_64-unknown-linux-musl.zip
unar yazi-x86_64-unknown-linux-musl.zip
cd yazi-x86_64-unknown-linux-musl
sudo mv yazi ya /usr/local/bin/