# ed machines files rename

> Renames one path, leaving it in the directory it is already in.

- Canonical URL: https://getedith.pro/docs/cli/machines-files/rename
- Updated: 2026-12-02

Renames one path, leaving it in the directory it is already in.

```
ed machines files rename <machine> <path> <name> [--json]
```

| Name | Type / values | Default | What it does |
| --- | --- | --- | --- |
| `machine` | machine name, SSH alias, id or unambiguous prefix | required | Which machine. |
| `path` | remote path | required | What to rename. |
| `name` | a bare name, no slashes | required | What to call it. |
| `--json` | flag | off | Emit JSON on stdout. |

```json
{
  "done": true,
  "machine": "Devbox",
  "path": "/home/you/notes.md",
  "to": "/home/you/journal.md"
}
```

```
ed machines files rename devbox /home/you/notes.md journal.md
ed machines files rename devbox /srv/app.conf app.conf.bak
ed machines files rename devbox /tmp/report.txt summary.txt --json
```

The new name is joined to the original path's directory, so the file stays
where it is. A name containing a slash is refused before anything is sent, and
exits 1 rather than 2:

```
$ ed machines files rename devbox /home/you/notes.md sub/journal.md
error: a new name cannot contain a slash
hint: use `ed machines files mv` to move it somewhere else
```

The rename is guarded on the machine: it tests for the target first and gives up
with status 17 if something is already there, so an existing name is refused
rather than overwritten. That guard prints nothing, which is why the refusal
arrives without detail:

```
$ ed machines files rename devbox /home/you/notes.md deploy.sh
error: renamed to /home/you/deploy.sh failed on Devbox
```

The `to` field carries the full new path, not the bare name you typed, and so
does the human line, which reads `renamed to /home/you/journal.md`.

## Where to go next

- [`ed machines files`](https://getedith.pro/docs/cli/machines-files), the rest of this group
- [All `ed` commands](https://getedith.pro/docs/cli)

## Get Edith

Edith is a native Mac app for macOS 14 or later on Apple silicon with 100+ extensions, the `ed` command line and an MCP server. $35 once for one Mac, plus $7 for each additional Mac, with no subscription and a 30-day refund.

- [Buy Edith](https://getedith.pro/pricing): $35 once for one Mac, plus $7 for each additional Mac
- [Download Edith](https://getedith.pro/download): the installer, or Homebrew
