# ed machines files duplicate

> Copies a file beside itself, naming the copy the way the window names it.

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

Copies a file beside itself, naming the copy the way the window names it.

```
ed machines files duplicate <machine> <path> [--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 duplicate. |
| `--json` | flag | off | Emit JSON on stdout. |

```json
{
  "machine": "Devbox",
  "path": "/home/you/report.txt",
  "to": "/home/you/report copy.txt"
}
```

```
ed machines files duplicate devbox /home/you/report.txt
ed machines files duplicate devbox /srv/app/config
ed machines files duplicate devbox /home/you/report.txt --json
```

The name is worked out on the machine: the extension is kept, ` copy` is added
to the stem, and if that is taken the number climbs, so `report.txt` gives
`report copy.txt`, then `report copy 2.txt`, then `report copy 3.txt`.
Duplicating twice never overwrites the first copy. The copy itself is `cp -R`,
so a directory duplicates whole, and the cap is 300 seconds.

One case differs from the app. A name that is nothing but an extension, such as
`.bashrc`, has an empty stem on the machine's arithmetic, so the CLI produces
` copy.bashrc` with a leading space where the window produces `.bashrc copy`.

A failure exits 1 and hands back what the machine printed:

```
$ ed machines files duplicate devbox /etc/hosts
error: could not duplicate /etc/hosts on Devbox
hint: cp: cannot create regular file '/etc/hosts copy': Permission denied
```

## 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
