← 返回命令列表

Linux command

multipass 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Launch a new Ubuntu instance

multipass launch --name [myvm]

Launch with specific Ubuntu version

multipass launch [22.04] --name [myvm]

Launch with custom resources

multipass launch --name [myvm] --cpus [2] --memory [4G] --disk [20G]

List all instances

multipass list

Open shell in instance

multipass shell [instance_name]

Execute command in instance

multipass exec [instance_name] -- [command]

Stop an instance

multipass stop [instance_name]

Delete and purge instance

multipass delete [instance_name] && multipass purge

说明

Multipass is a lightweight VM manager for Ubuntu instances. Developed by Canonical, it provides a fast way to launch Ubuntu virtual machines on Linux, macOS, and Windows, optimized for cloud-style workflows. Instances boot quickly from cached cloud images. The hypervisor backend varies by platform: QEMU or LXD on Linux, QEMU (with Hypervisor.framework) on macOS, and Hyper-V on Windows. Instances get DHCP networking with host connectivity out of the box. Cloud-init support enables automated provisioning. You can pass cloud-init YAML to install packages, configure users, run scripts, and more during first boot - matching cloud deployment workflows locally. Mount functionality shares host directories with instances, useful for development. File transfers work both directions. Multiple instances can run simultaneously, limited by system resources. The tool is particularly useful for testing Ubuntu server configurations, developing cloud applications locally, and quick disposable development environments.

参数

launch _image_
Create and start a new instance.
list, ls
List all instances.
shell _instance_
Open shell in instance.
exec _instance_ -- _command_
Run command in instance.
start _instance_
Start stopped instance.
stop _instance_
Stop running instance.
restart _instance_
Restart instance.
delete _instance_
Delete instance (recoverable until purge).
purge
Permanently remove deleted instances.
recover _instance_
Restore deleted instance.
info _instance_
Show instance details.
mount _source_ _instance:target_
Mount host directory in instance.
umount _mount_
Unmount directory.
transfer _source_ _destination_
Copy files between host and instance.
find
List available images.
--name _NAME_
Instance name.
--cpus _NUM_
Number of CPUs.
--memory _SIZE_
RAM allocation (e.g., 2G).
--disk _SIZE_
Disk size (e.g., 10G).
--cloud-init _FILE_
Cloud-init configuration file.
--network _SPEC_
Add a network interface to the instance.
--bridged
Add a network interface bridged to the default bridge.

FAQ

What is the multipass command used for?

Multipass is a lightweight VM manager for Ubuntu instances. Developed by Canonical, it provides a fast way to launch Ubuntu virtual machines on Linux, macOS, and Windows, optimized for cloud-style workflows. Instances boot quickly from cached cloud images. The hypervisor backend varies by platform: QEMU or LXD on Linux, QEMU (with Hypervisor.framework) on macOS, and Hyper-V on Windows. Instances get DHCP networking with host connectivity out of the box. Cloud-init support enables automated provisioning. You can pass cloud-init YAML to install packages, configure users, run scripts, and more during first boot - matching cloud deployment workflows locally. Mount functionality shares host directories with instances, useful for development. File transfers work both directions. Multiple instances can run simultaneously, limited by system resources. The tool is particularly useful for testing Ubuntu server configurations, developing cloud applications locally, and quick disposable development environments.

How do I run a basic multipass example?

Run `multipass launch --name [myvm]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does launch _image_ do in multipass?

Create and start a new instance.