`multipass exec` command

The multipass exec command executes the given commands inside the instance. The first argument is the instance to run the commands on, -- optionally separates the multipass options from the rest - the command to run itself:

$ multipass exec primary -- uname -r

You can pipe standard input and output to/from the command:

$ multipass exec primary -- lsb_release -a | grep ^Codename:
No LSB modules are available.
Codename:       bionic

The full multipass help exec output explains the available options:

$ multipass help exec
Usage: multipass exec [options] <name> [--] <command>
Run a command on an instance

  -h, --help     Display this help
  -v, --verbose  Increase logging verbosity, repeat up to three times for more

  name           Name of instance to execute the command on
  command        Command to execute on the instance

The -- separator is required if you want to pass options to the command being run.

Last updated 10 months ago.