Errors or typos? Topics missing? Hard to read? Let us know or open an issue on GitHub.
See also: Instance
This document demonstrates various ways to use an instance.
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 run 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 the following command:
$ 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.
Stop an instance forcefully
If the multipass stop
command doesn’t work, you can use the --force
argument to force the instance to shut down immediately. This is particularly useful when the virtual machine is in a non-responsive, unknown or suspended state.
$ multipass stop --force
The stop --force
command is analogous to unplugging the power cord from a physical machine – it immediately halts all computing activities. This may be necessary under certain circumstances but can potentially lead to data loss or corruption.
This command is also available on the Multipass GUI.
Let us know how this worked for you and what you’d like to see next!