How to use the new terminal-based file manager in Linux?

NixOS + Linux

How to use the terminal-based file manager in Linux?

Learn about the file manager which works in your terminal.

--

As a Linux user and developer, Most of the time, I work with neovim and Terminal, and I hate the most about file manager every time I open a separate application to explore files.

I recently found an exciting project that solves every problem which I have been facing for a long time.

The file manager's name is Yazi. The Yazi is a️ Blazing fast terminal-based file manager written in Rust.

With that, you can explore the files in your Terminal. You can see the file preview, create files and folders, and Search files and folders in the Terminal.

For other features, you can check out the feature page on yazi documentation.

To use Yazi, you need to follow the given steps below:

  1. Optional Tools
  2. Installation
    NixOS
    Homebrew
    Scoop
    Homebrew
  3. How to Uses
    Create File and Folder
    Navigation folder and file
  4. Configuration
    General configuration
    Keybindings configuration
    Color scheme(theme) configuration
  5. Conclusion

Optional Tools

To enable additional features in yazi, you must install other command line tools, which is optional.

Installation

Yazi has several methods available to install it in the operating system, and you can install it according to your operating system.

NixOS

Imperative:

# NixOS:
nix-env -iA nixos.yazi

# Not NixOS:
nix-env -iA nixpkgs.yazi

Declarative:

# configuration.nix

environment.systemPackages = with pkgs; [
yazi
];

# Home Manager

home.packages = with pkgs; [
yazi
]

# Install Optionally packages

environment.systemPackages = with pkgs; [
yazi
ffmpegthumbnailer
unar
jq
poppler
fd
ripgrep
fzf
zoxide
];

Homebrew

brew install yazi ffmpegthumbnailer unar jq poppler fd ripgrep fzf zoxide font-symbols-only-nerd-font

Scoop

scoop install yazi
# Install the optional dependencies (recommended):
scoop install unar jq poppler fd ripgrep fzf zoxide

Homebrew

brew update

# then run following command.

brew install yazi ffmpegthumbnailer unar jq poppler fd ripgrep fzf zoxide font-symbols-only-nerd-font

For other operating system, you can follow the official installation page on documentation.

How to Uses

The use of yazi is very simple, similar to another CLI command. Just type yazi in your terminal, and yazi will open in the same location.

yazi

Now, yazi look like this in your terminal.

Your yazi looks like this in the terminal.

Create File and Folder

With yazi functionality, you not only explore the files, but you can also create folders and files.

To create a file or folder, open yazi and type ain the terminal. For files, type the file name with the extension; for the folder, write the name and add / at the end of the folder name.

Type folder or file name with extension.
Type folder or file name with extension.

Navigation folder and file

To explore or navigate the folder, you can use the arrow key or use K, j, i, h.

  1. kor ↑ Move the cursor up
  2. j or ↓ Move the cursor down
  3. i or → Enter the directory
  4. h or ← Leave the current directory and into its parent.

Yazi has other functionalities such as selection, searching, filtering, Finding, Sorting, etc. For that, you can follow yazi documentation.

Configuration

There are three ways to configure the yazi according to your requirements. For that, you need to create three different files:

  1. yazi.toml: General configuration.
  2. keymap.toml: Keybindings configuration.
  3. theme.toml: Color scheme(theme) configuration.

To override the default configuration, you need to create the corresponding file in the following location based on your OS:

  1. ~/.config/yazi/ on Unix-like OS such as Linux Distro, MacOS.
  2. C:\Users\USERNAME\AppData\Roaming\yazi\config\ on Windows.

General configuration

For general configuration, you need to create a yazi.toml. In yazi, There is a long list of general configurations. In the following example, I tell you how you can use:

# .config/yazi/yazi.toml

[manager]

show_hidden = true
show_symlink = true
sort_by = "created"
linemode = "mtime"

For other configurations, you can follow the yazi general configuration documentation page.

Keybindings configuration

For keybindings configuration, you need to create a keymap.toml. The building keybindings are a bit hard to understand for newcomers. The yazi comes with six layers of key bindings:

  1. [manager]: File list.
  2. [tasks]: Task manager.
  3. [select]: Select a component. e.g., “open with” for files.
  4. [input]: Input component. e.g., create, rename, etc.
  5. [completion]: Completion component. e.g., “cd” path completion.
  6. [help]: Help menu.

Check out the default available keymap option list on yazi.

Every layer has two attributes or APIs: prepend_keymap and append_keymap.

  1. prepend_keymap: Prepend_keymap attribute inserts before the default keybindings.
  2. append_keymap: applend_keymap attribute inserts after the default keybindings.

For example, I created my own customized keybinding, and when I hit Ctrl + b on my keyboard, I go back to the parent directory.

# .config/yazi/keymap.toml

[manager]

prepend_keymap = [
{ on = [ "<C-b>" ], run = "back", desc = "Go back to the parent directory" },
]

Learn the keymap options:

  1. on: it contains your own customize keyboard command such Ctrl + b, Z, a, shift + u, etc.
  2. run: when you press the keyboard command, what command would you like to run in yazi, such as enter, back, select, leave, enter, etc.
  3. desc: it contains the description about your keymap.

Yazi comes with a pre-inbuilt bunch of run options. To learn about the available run options, follow the yazi keymap documentation page.

Color scheme(theme) configuration

Yazi comes with a few ready-made themes; you need to go to the yazi-rs/flavors repository inside , download the theme inside .config/yazi/flavors/folder and mention the theme name in the theme.toml file.

# .config/yazi/theme.toml

[flavor]
use = "catppuccin-mocha"

To build your customised theme, check out the yazi theme documentation page.

To download the specific theme from the yazi-rs/flavors repository, you can use the following website: https://download-directory.github.io/

Conclusion

Yazi is not the only file manager that works inside the terminal; you can also use Ranger and NNN file managers.

With Yazi, you can easily configure it according to your requirements. For beginners, learning yazi takes some time.

After installing an optional package for yazi, sometimes previews don’t work.

To learn more about Nixos and Linux stuff, follow the Linux publication on Medium and other updates. Follow me on Twitter (X) and Medium.

--

--

Rajdeep Singh
The Linux

JavaScript | TypeScript | Reactjs | Nextjs | Rust | Biotechnology | Bioinformatic | Frontend Developer | Author | https://linktr.ee/officialrajdeepsingh