How to use an instance

See also: Instance

This document demonstrates various ways to use an instance.

Contents:

Open a shell prompt inside an instance

See also: shell

To open a shell prompt on an existing instance loving-duck, execute the following command:

$ multipass shell loving-duck
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-109-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Tue May 31 14:26:40 -03 2022

  System load:  0.0               Processes:             113
  Usage of /:   28.8% of 4.67GB   Users logged in:       0
  Memory usage: 21%               IPv4 address for ens3: 10.49.93.241
  Swap usage:   0%


1 update can be applied immediately.
To see these additional updates run: apt list --upgradable


The list of available updates is more than a week old.
To check for new updates run: sudo apt update

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

ubuntu@loving-duck:~$ 

If the instance loving-duck is stopped or suspended, it will be started automatically. If no argument is given to the shell command, a shell prompt on the primary instance will be opened (creating the primary instance if it doesn’t exist).

As shown in the example above, an Ubuntu prompt is displayed as result of the shell command. Commands may be executed on this shell. After that, the session can be closed with logout, exit or hitting Ctrl-D.

Also available from the GUI.

Execute a command inside an instance

See also: exec

To execute a single command inside an instance, it is not needed to open a shell. The command can be directly called from the host, invoking

$ multipass exec loving-duck -- pwd
/home/ubuntu

In the example, /home/ubuntu is the output of invoking the pwd command on the loving-duck instance.

Start an instance

See also: start

An instance which was already created and is shown as Stopped or Suspended can be started with

$ multipass start loving-duck

More than one instance can be started at once, specifying all the instance names in the command line:

$ multipass start loving-duck devoted-lionfish sensible-shark

Additionally, all the existing instances can be started at once, with the --all argument:

$ multipass start --all

If the instance names or --all argument are omitted, the primary instance will be started, creating it if needed.

Also available from the GUI.

Suspend an instance

See also: suspend

An instance can be suspended with the command:

$ multipass suspend loving-duck

More than one instance can be suspended at once, specifying all the names in the command line:

$ multipass suspend loving-duck devoted-lionfish sensible-shark

Additionally, the --all argument suspends all the running instances:

$ multipass suspend --all

If instance names and the --all argument are omitted, the primary instance will be suspended if it exists and is running.

Stop an instance

See also: stop

A running, not suspended instance is stopped with the command:

$ multipass stop loving-duck

Multiple running instances can be suspended at once, specifying all their names in the command line:

$ multipass stop loving-duck devoted-lionfish sensible-shark

All running instances are stopped at once with the --all argument:

$ multipass stop --all

If instance names and the --all argument are omitted, the primary instance will be stopped if it exists and is running and not suspended.

Also available from the GUI.


Last updated 5 months ago.