---
name: "vmexec-exec"
section: "1"
platform: "linux"
package: "vmexec"
version: "0.8.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/vmexec-exec"
---

# vmexec-exec(1)

Run a command in an existing virtual machine

## NAME

vmexec-exec - Run a command in an existing virtual machine

## SYNOPSIS

**vmexec exec** \[**-e**\|**--env**\] \[**-w**\|**--workdir**\] \[**-s**\|**--ssh-timeout**\] \[**-i**\|**--interactive**\] \[**-t**\|**--tty**\] \[**-h**\|**--help**\] \<*VMID*\> \[*ARGS*\]

## DESCRIPTION

Run a command in an existing virtual machine

## OPTIONS

- **-e**, **--env** *\<ENV\>*

  Set environment variables for the process inside the virtual machine

  Can be provided multiple times.

  Expected format: KEY=VALUE

- **-w**, **--workdir** *\<WORKDIR\>*

  Working directory inside the virtual machine

  The default working directory for running binaries within a virtual machine is dependent on the image. Most commonly, it'll be /root.

- **-s**, **--ssh-timeout** *\<SSH\_TIMEOUT\>* \[default: 20\]

  SSH connection timeout

  Try for this long (in seconds) to connect to the virtual machine's SSH server.

- **-i**, **--interactive** *\<INTERACTIVE\>* \[default: auto\]

  Make STDIN available to the virtual machine's process

  If 'auto', this will try to read from stdin if it is available, and do nothing when stdin is not available. If 'always', this will try to read from stdin and abort when stdin is not available.\

  *Possible values:*

  - •

    always: Forward stdin and fail if it can't be opened

  - •

    never: Don't forward stdin

  - •

    auto: Forward stdin if it can be opened, otherwise carry on without it

- **-t**, **--tty** *\<TTY\>* \[default: auto\]

  Allocate a pseudo-TTY for the virtual machine

  If 'auto', this will be enabled in case vmexec is run from an interactive terminal.\

  *Possible values:*

  - •

    always: Allocate a pseudo-TTY

  - •

    never: Don't allocate a pseudo-TTY

  - •

    auto: Allocate a pseudo-TTY if stdout is a terminal

- **-h**, **--help**

  Print help (see a summary with '-h')

- \<*VMID*\>

  Identifier of a running virtual machine

- \[*ARGS*\]

  Arguments to run in the virtual machine
