---
sidebar_position: 2
description: A quick guide on the basic usage of Yazi.
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Quick Start
Once you've [installed Yazi](/docs/installation), start the program with:
```sh
yazi
```
Press q to quit, F1 or ~ to open the help menu.
## Shell wrapper
We suggest using this `y` shell wrapper that provides the ability to change the current working directory when exiting Yazi.
```bash
function y() {
local tmp cwd; tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
command yazi "$@" --cwd-file="$tmp"
IFS= read -r -d '' cwd < "$tmp"
[ "$cwd" != "$PWD" ] && [ -d "$cwd" ] && builtin cd -- "$cwd" || builtin true
command rm -f -- "$tmp"
}
```
```sh
function y
set tmp (mktemp -t "yazi-cwd.XXXXXX")
command yazi $argv --cwd-file="$tmp"
if read -z cwd < "$tmp"; and [ "$cwd" != "$PWD" ]; and test -d "$cwd"
builtin cd -- "$cwd"
end
command rm -f -- "$tmp"
end
```
```sh
def --env y [...args] {
let tmp = (mktemp -t "yazi-cwd.XXXXXX")
^yazi ...$args --cwd-file $tmp
let cwd = (open $tmp)
if $cwd != $env.PWD and ($cwd | path exists) {
cd $cwd
}
rm -fp $tmp
}
```
```sh
y() {
set -- "$@" --cwd-file "$(mktemp -t yazi-cwd.XXXXXX)"
command yazi "$@"
shift $(($# - 1))
set -- "$(command cat < "$1"; printf .; command rm -f -- "$1")"
set -- "${1%.}"
[ "$1" != "$PWD" ] && [ -d "$1" ] && command cd -- "$1" || command true
}
```
```elvish
edit:add-var y~ {|@argv|
use str
use os
use file
var tmp = (os:temp-file)
e:yazi $@argv --cwd-file=$tmp[name]
var cwd = (slurp < $tmp)
file:close $tmp
os:remove $tmp[name]
if (and (not-eq $cwd $pwd) (os:is-dir $cwd)) {
cd $cwd
}
}
```
```powershell
function y {
$tmp = (New-TemporaryFile).FullName
yazi.exe @args --cwd-file="$tmp"
$cwd = Get-Content -Path $tmp -Encoding UTF8
if ($cwd -and $cwd -ne $PWD.Path -and (Test-Path -LiteralPath $cwd -PathType Container)) {
Set-Location -LiteralPath (Resolve-Path -LiteralPath $cwd).Path
}
Remove-Item -Path $tmp
}
```
Create the file `y.cmd` and place it in your `%PATH%`.
```cmd
@echo off
set tmpfile=%TEMP%\yazi-cwd.%random%
yazi.exe %* --cwd-file="%tmpfile%"
:: If the file does not exist, then exit
if not exist "%tmpfile%" exit /b 0
:: If the file exist, then read the content and change the directory
set /p cwd=<"%tmpfile%"
if not "%cwd%"=="" if exist "%cwd%\" (
cd /d "%cwd%"
)
del "%tmpfile%"
```
```xonsh
def _y(args):
tmp = $(mktemp -t "yazi-cwd.XXXXXX")
args.append(f"--cwd-file={tmp}")
$[yazi @(args)]
with open(tmp) as f:
cwd = f.read()
import os
if cwd != $PWD and os.path.isdir(cwd):
cd @(cwd)
rm -f -- @(tmp)
aliases["y"] = _y
```
```scheme
(sh-alias "y"
(lambda (args)
(let ((tmp (sh-run/string-rtrim-newlines {mktemp -t "yazi-cwd.XXXXXX"})))
(dynamic-wind
void
(lambda ()
(sh-run {command yazi (values args) (string-append "--cwd-file=" tmp)})
(let ((cwd (call-with-input-file tmp get-string-all)))
(when (and (not (eof-object? cwd))
(not (string=? cwd (charspan->string (sh-cwd (sh-globals)))))
(file-directory? cwd))
(sh-cd (sh-globals) cwd))))
(lambda ()
(file-delete tmp))))
(quote ())))
```
To use it, copy the function into the configuration file of your respective shell.
Then use `y` instead of `yazi` to start, and press q to quit, you'll see the CWD changed. Sometimes, you don't want to change, press Q to quit.
## Keybindings
:::tip
For all keybindings, see the [default `keymap.toml` file](https://github.com/sxyazi/yazi/blob/shipped/yazi-config/preset/keymap-default.toml).
:::
### Navigation
To navigate between files and directories you can use the arrow keys ←, ↓, ↑ and →
or Vim-like keys such as h, j, k, l:
| Key binding | Alternate key | Action |
| ------------ | ------------- | ----------------------------------------------- |
| k | ↑ | Move the cursor up |
| j | ↓ | Move the cursor down |
| l | → | Enter hovered directory |
| h | ← | Leave the current directory and into its parent |
Further navigation actions can be found in the table below.
| Key binding | Action |
| ------------------------------- | --------------------------------------------------------------------------------- |
| K | Seek up 5 units in the preview |
| J | Seek down 5 units in the preview |
| g ⇒ g | Move cursor to the top |
| G | Move cursor to the bottom |
| g ⇒ t | Go to the trash bin |
| z | [Cd][mgr.cd] to a directory or [reveal][mgr.reveal] a file via fzf |
| Z | [Cd][mgr.cd] to a directory via zoxide |
| g ⇒ Space | [Cd][mgr.cd] to a directory or [reveal][mgr.reveal] a file via interactive prompt |
[mgr.cd]: /docs/configuration/keymap#mgr.cd
[mgr.reveal]: /docs/configuration/keymap#mgr.reveal
### Selection
To select files and directories, the following actions are available.
| Key binding | Action |
| ------------------------------ | ------------------------------------------ |
| Space | Toggle selection of hovered file/directory |
| v | Enter visual mode (selection mode) |
| V | Enter visual mode (unset mode) |
| Ctrl + a | Select all files |
| Ctrl + r | Inverse selection of all files |
| Esc | Cancel selection |
### File operations
To interact with selected files/directories use any of the actions below.
| Key binding | Action |
| ----------------------------------- | ----------------------------------------------------------------------- |
| o | Open selected files |
| O | Open selected files interactively |
| Enter | Open selected files |
| Shift + Enter | Open selected files interactively (some terminals don't support it yet) |
| Tab | Show the file information |
| y | Yank selected files (copy) |
| x | Yank selected files (cut) |
| p | Paste yanked files |
| P | Paste yanked files (overwrite if the destination exists) |
| Y or X | Cancel the yank status |
| d | Trash selected files |
| D | Permanently delete selected files |
| a | Create a file (ends with / for directories) |
| r | Rename selected file(s) |
| . | Toggle the visibility of hidden files |
Further file operation actions can be found in the table below.
| Key binding | Action |
| ------------------------------ | ------------------------------------------ |
| ; | Run a shell command |
| : | Run a shell command (block until finishes) |
| - | Symlink the absolute path of yanked files |
| \_ | Symlink the relative path of yanked files |
| Ctrl + - | Hardlink yanked files |
### Copy paths
To copy paths, use any of the following actions below.
_Observation: c ⇒ d indicates pressing the c key followed by pressing the d key._
| Key binding | Action |
| --------------------------- | ----------------------------------- |
| c ⇒ c | Copy the file path |
| c ⇒ d | Copy the directory path |
| c ⇒ f | Copy the filename |
| c ⇒ n | Copy the filename without extension |
### Filter files
| Key binding | Action |
| ------------ | ------------ |
| f | Filter files |
### Find files
| Key binding | Action |
| ------------ | ------------------------ |
| / | Find next file |
| ? | Find previous file |
| n | Go to the next found |
| N | Go to the previous found |
### Search files
| Key binding | Action |
| ------------------------------ | ------------------------------------------------------------------------------ |
| s | Search files by name using [fd](https://github.com/sharkdp/fd) |
| S | Search files by content using [ripgrep](https://github.com/BurntSushi/ripgrep) |
| Ctrl + s | Cancel the ongoing search |
### Sorting
To sort files/directories use the following actions.
_Observation: , ⇒ a indicates pressing the , key followed by pressing the a key._
| Key binding | Action |
| --------------------------- | -------------------------------- |
| , ⇒ m | Sort by modified time |
| , ⇒ M | Sort by modified time (reverse) |
| , ⇒ b | Sort by birth time |
| , ⇒ B | Sort by birth time (reverse) |
| , ⇒ e | Sort by file extension |
| , ⇒ E | Sort by file extension (reverse) |
| , ⇒ a | Sort alphabetically |
| , ⇒ A | Sort alphabetically (reverse) |
| , ⇒ n | Sort naturally |
| , ⇒ N | Sort naturally (reverse) |
| , ⇒ s | Sort by size |
| , ⇒ S | Sort by size (reverse) |
| , ⇒ r | Sort randomly |
### Multi-tab
| Key binding | Action |
| --------------------------------------------- | ---------------------------------- |
| t ⇒ t | Create a new tab in CWD |
| 1, 2, ..., 9 | Switch to the N-th tab |
| [ | Switch to the previous tab |
| ] | Switch to the next tab |
| \{ | Swap current tab with previous tab |
| } | Swap current tab with next tab |
| Ctrl + c | Close the current tab |
### Task manager
View running background tasks or failed tasks in the task manager.
| Key binding | Action |
| --------------------------------------------- | ---------------------------------- |
| w | Open the task manager |
## Flavors
Pick a color scheme you like from our [flavors repository](https://github.com/yazi-rs/flavors), or [cook a flavor](/docs/flavors/overview#cooking)!