← 返回命令列表

Linux command

systemd-detect-virt 命令

文本

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

常用示例

List

systemd-detect-virt --list

Detect

systemd-detect-virt

Silently

systemd-detect-virt -q

Only

systemd-detect-virt -c

Only

systemd-detect-virt -v

Detect

systemd-detect-virt -r

说明

systemd-detect-virt detects whether the system is running in a virtualized environment and prints the detected virtualization technology. It returns exit code 0 if virtualization is detected, non-zero otherwise. Detectable technologies include: KVM, QEMU, VMware, VirtualBox, Xen, Hyper-V, Docker, LXC, systemd-nspawn, and many others. The --list option shows all supported technologies.

参数

--list
List all detectable virtualization technologies
-q, --quiet
Suppress output, only return exit code
-c, --container
Only detect container virtualization
-v, --vm
Only detect hardware VM virtualization
-r, --chroot
Detect chroot environment
--private-users
Detect user namespace

FAQ

What is the systemd-detect-virt command used for?

systemd-detect-virt detects whether the system is running in a virtualized environment and prints the detected virtualization technology. It returns exit code 0 if virtualization is detected, non-zero otherwise. Detectable technologies include: KVM, QEMU, VMware, VirtualBox, Xen, Hyper-V, Docker, LXC, systemd-nspawn, and many others. The --list option shows all supported technologies.

How do I run a basic systemd-detect-virt example?

Run `systemd-detect-virt --list` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --list do in systemd-detect-virt?

List all detectable virtualization technologies