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

# cp

> Copy files to/from a CVM via SCP

<Note>
  This command is marked as unstable and may change in future releases.
</Note>

### Command: `phala cp`

#### Syntax

```
phala cp [options] <source> <destination>
```

#### Description

Copy files to/from a CVM via SCP

#### Arguments

| Argument        | Description                                                                 |
| --------------- | --------------------------------------------------------------------------- |
| `<source>`      | Source path (local or cvm-name:path, use :path for phala.toml cvm\_id)      |
| `<destination>` | Destination path (local or cvm-name:path, use :path for phala.toml cvm\_id) |

#### Options

| Option                   | Description                                       |
| ------------------------ | ------------------------------------------------- |
| `-i, --identity <value>` | SSH identity file (private key)                   |
| `-p, --port <value>`     | SSH port (priority: CLI > phala.toml > 443)       |
| `-g, --gateway <value>`  | Gateway domain (priority: CLI > phala.toml > API) |
| `-r, --recursive`        | Recursively copy directories                      |
| `-v, --verbose`          | Show verbose SCP details                          |
| `--dry-run`              | Print SCP command without executing               |

#### Global Options

| Option                               | Description                                               |
| ------------------------------------ | --------------------------------------------------------- |
| `-h, --help`                         | Show help information for the current command             |
| `--version`                          | Show CLI version                                          |
| `--api-token TOKEN, --api-key TOKEN` | API token for authenticating with Phala Cloud             |
| `-j, --json, --no-json`              | Output in JSON format                                     |
| `--interactive`                      | Enable interactive mode for commands that support it      |
| `--cvm-id <value>`                   | CVM identifier (UUID, app\_id, instance\_id, or name)     |
| `--profile PROFILE`                  | Temporarily use a different auth profile for this command |
| `--api-version <value>`              | API version to use (e.g. 2025-10-28, 2026-01-21)          |

#### Examples

* Upload from phala.toml

```bash theme={"system"}
phala cp ./local.txt :/root/remote.txt
```

* Upload to CVM

```bash theme={"system"}
phala cp ./local.txt app_123:/root/remote.txt
```

* Download from CVM

```bash theme={"system"}
phala cp app_123:/root/remote.txt ./local.txt
```

* Offline mode

```bash theme={"system"}
phala cp -g dstack-pha-prod7.phala.network -p 16185 ./file.txt app_123:/root/
```

* Upload directory recursively

```bash theme={"system"}
phala cp -r ./local_dir app_123:/root/remote_dir
```

* Copy with custom SSH key

```bash theme={"system"}
phala cp -i ~/.ssh/custom_key app_123:/root/file.txt ./file.txt
```

* Print the SCP command without executing

```bash theme={"system"}
phala cp ./local.txt app_123:/root/remote.txt --dry-run
```
