> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/sxyazi/yazi/llms.txt
> Use this file to discover all available pages before exploring further.

# File Operations

> Creating, copying, moving, deleting, and managing files in Yazi

Yazi provides powerful file operation commands with a Vim-like yank-paste model.

## Opening Files

| Key               | Command              | Description                                  |
| ----------------- | -------------------- | -------------------------------------------- |
| `o` / `<Enter>`   | `open`               | Open selected files with default application |
| `O` / `<S-Enter>` | `open --interactive` | Open with application chooser                |

<Note>
  Yazi will open files using your system's default applications, or you can configure custom openers in `yazi.toml`.
</Note>

## Creating Files and Directories

Press `a` to create new files or directories:

<Steps>
  <Step title="Press `a`">
    Activate the create command
  </Step>

  <Step title="Enter name">
    Type the file or directory name
  </Step>

  <Step title="Create directory">
    End the name with `/` to create a directory instead of a file
  </Step>
</Steps>

**Examples:**

```bash theme={null}
# Create a file
a → "newfile.txt" → <Enter>

# Create a directory
a → "newfolder/" → <Enter>

# Create nested directories
a → "path/to/directory/" → <Enter>
```

## Yank (Copy) and Cut

Yazi uses a yank-paste model similar to Vim:

### Yank Commands

| Key       | Command      | Description                   |
| --------- | ------------ | ----------------------------- |
| `y`       | `yank`       | Yank (copy) selected files    |
| `x`       | `yank --cut` | Cut selected files for moving |
| `Y` / `X` | `unyank`     | Cancel the yank/cut operation |

<Tabs>
  <Tab title="Copy Workflow">
    <Steps>
      <Step title="Select files">
        Select one or more files (see [Selection](usage/selection))
      </Step>

      <Step title="Yank">
        Press `y` to copy files to the yank buffer
      </Step>

      <Step title="Navigate">
        Navigate to the destination directory
      </Step>

      <Step title="Paste">
        Press `p` to paste the files
      </Step>
    </Steps>
  </Tab>

  <Tab title="Move Workflow">
    <Steps>
      <Step title="Select files">
        Select one or more files
      </Step>

      <Step title="Cut">
        Press `x` to cut files to the yank buffer
      </Step>

      <Step title="Navigate">
        Navigate to the destination directory
      </Step>

      <Step title="Paste">
        Press `p` to paste (move) the files
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Paste Operations

| Key | Command         | Description                        |
| --- | --------------- | ---------------------------------- |
| `p` | `paste`         | Paste yanked files                 |
| `P` | `paste --force` | Paste and overwrite existing files |

<Warning>
  Using `P` (paste with force) will overwrite files with the same name at the destination without confirmation.
</Warning>

## Symbolic and Hard Links

Create links to yanked files:

| Key     | Command           | Description                          |
| ------- | ----------------- | ------------------------------------ |
| `-`     | `link`            | Create symbolic link (absolute path) |
| `_`     | `link --relative` | Create symbolic link (relative path) |
| `<C-->` | `hardlink`        | Create hard link to yanked files     |

**Link workflow:**

```bash theme={null}
# 1. Yank the source file
y

# 2. Navigate to destination
cd /path/to/destination

# 3. Create link
-    # Absolute symlink
_    # Relative symlink
<C-->  # Hard link
```

## Deleting Files

Yazi supports both trash and permanent deletion:

| Key | Command                | Description                                 |
| --- | ---------------------- | ------------------------------------------- |
| `d` | `remove`               | Move selected files to trash                |
| `D` | `remove --permanently` | Permanently delete files (cannot be undone) |

<Warning>
  Permanent deletion (`D`) bypasses the trash bin and cannot be recovered. Use with caution!
</Warning>

## Renaming Files

Press `r` to rename files:

```bash theme={null}
r  # Opens rename input with cursor before the file extension
```

The `rename --cursor=before_ext` command positions the cursor intelligently:

* For `document.txt`, cursor appears after "document" and before ".txt"
* For files without extensions, cursor appears at the end

<Note>
  Yazi also supports bulk renaming through external editors. Check the plugins documentation for advanced renaming options.
</Note>

## Copy Path/Name

Copy file information to the clipboard:

| Keybinding | Command                 | Description                     |
| ---------- | ----------------------- | ------------------------------- |
| `cc`       | `copy path`             | Copy absolute file path         |
| `cd`       | `copy dirname`          | Copy parent directory path      |
| `cf`       | `copy filename`         | Copy filename with extension    |
| `cn`       | `copy name_without_ext` | Copy filename without extension |

**Example output:**

```bash theme={null}
cc → /home/user/documents/report.pdf
cd → /home/user/documents
cf → report.pdf
cn → report
```

## Shell Commands

Execute shell commands on selected files:

| Key | Command                       | Description                              |
| --- | ----------------------------- | ---------------------------------------- |
| `;` | `shell --interactive`         | Run shell command (async)                |
| `:` | `shell --block --interactive` | Run shell command (block until finished) |

<Tabs>
  <Tab title="Interactive Shell (`;`)">
    Non-blocking shell execution. Yazi continues running while the command executes.

    ```bash theme={null}
    ;  # Opens shell prompt
    → echo "Processing..." && sleep 5
    # Yazi remains interactive
    ```
  </Tab>

  <Tab title="Blocking Shell (`:`)">
    Blocking shell execution. Yazi waits for the command to complete.

    ```bash theme={null}
    :  # Opens shell prompt
    → git status
    # Yazi waits for output
    ```
  </Tab>
</Tabs>

## Hidden Files

Toggle visibility of hidden files:

```bash theme={null}
.  # Toggle hidden files on/off
```

## File Selection Preview

When files are selected or in the yank buffer, Yazi displays:

* **Yellow highlight**: Files in the yank buffer (copied)
* **Red highlight**: Files in the cut buffer (cut for moving)
* **Visual selection**: Files selected in visual mode
