---
title: "VM CLI"
description: "Use the Freestyle CLI for quick VM operations and debugging."
url: "/docs/vms/cli"
---

The Freestyle CLI is useful for one-off operations while developing or debugging.


## Prerequisites

Set your API key:

```bash
export FREESTYLE_API_KEY="your-api-key"
```

Run commands through `npx`:

```bash
npx freestyle --help
```


## List VMs

```bash
npx freestyle vm list
```

Use JSON output when scripting:

```bash
npx freestyle vm list --json
```


## Create And Exec

```bash
npx freestyle vm create --exec 'uname -a'
```

Delete the VM after the command completes:

```bash
npx freestyle vm create --exec 'npm test' --delete
```


## SSH

```bash
npx freestyle vm create --ssh
```

For a temporary debug session:

```bash
npx freestyle vm create --ssh --delete
```


## Operate On An Existing VM

```bash
npx freestyle vm exec <vm-id> 'pwd'
npx freestyle vm delete <vm-id>
```

Use the SDK for long-lived application workflows and the CLI for operational tasks.
