machinectl(1)
Control the systemd machine registry and manage virtual machines and containers.
Synopsis
machinectl [OPTIONS...] COMMAND [ARGS...]Description
machinectl is used to introspect and control the state of virtual machines and containers registered with systemd-machined. It can list running machines, check their status, start and stop them, and access their consoles or shells.
The tool operates on machines registered with systemd's machine manager, which includes VMs managed by systemd-nspawn, libvirt, and other container runtimes that integrate with systemd.
Common options
| Flag | What it does |
|---|---|
-a, --all | show all machines, including those not running |
-p, --property=NAME | show specific properties of machines |
-M, --machine=NAME | operate on the specified machine |
-n, --lines=INTEGER | number of journal lines to show (default 10) |
--no-pager | do not pipe output into a pager |
-l, --full | do not truncate output |
--output=FORMAT | output format: table, tree, json, or json-seq |
-q, --quiet | suppress informational messages |
--no-legend | do not print header and footer |
Examples
list all registered machines and their status
machinectl listshow detailed status of a specific container
machinectl status mycontainerstart a registered machine or container
machinectl start mycontainerstop a running machine gracefully
machinectl stop mycontaineropen an interactive shell in the specified machine
machinectl shell mycontaineropen an interactive login session in the machine
machinectl login mycontainerlist all machines including stopped ones in JSON format
machinectl list -a -o jsoncopy a file into a running machine
machinectl copy-to mycontainer /tmp/file /root/