`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 -- separator is required if you want to pass options to the command being run.

See also multipass exec and shells, for an explanation of how this command interacts with shells.

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

Last updated a month ago.