Linux command
machinectl 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
List
machinectl list
Start
sudo machinectl start machine_name
Stop
sudo machinectl stop machine_name
Example
sudo machinectl shell machine_name
Login
sudo machinectl login machine_name
Example
machinectl status machine_name
Execute
sudo machinectl shell machine_name /bin/command
说明
machinectl controls the systemd machine manager. It manages local containers and virtual machines through systemd-machined, including starting, stopping, and interacting with them.
参数
- -p, --property
- Show specific property
- -a, --all
- Show all properties
- -q, --quiet
- Suppress output
- --uid USER
- User to run shell command as
- -E, --setenv VAR=VALUE
- Set environment variable in shell
- -H, --host _USER@HOST_
- Execute on remote host via SSH.
- -M, --machine _NAME_
- Execute in local container.
- -h, --help
- Print a short help text and exit.
- --version
- Print a short version string and exit.
- --no-pager
- Do not pipe output into a pager.
- --no-legend
- Do not print the legend (column headers and hints).
FAQ
What is the machinectl command used for?
machinectl controls the systemd machine manager. It manages local containers and virtual machines through systemd-machined, including starting, stopping, and interacting with them.
How do I run a basic machinectl example?
Run `machinectl list` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -p, --property do in machinectl?
Show specific property