// Module included in the following assemblies:
//
// * virt/virtual_machines/virt-controlling-vm-states.adoc

[id="virt-cli-reference-controlling-vms_{context}"]
= CLI reference for controlling virtual machines

Use the following `virtctl` client utility and `oc` commands to change the state of the virtual
machines and display lists of the virtual machines and the virtual machine instances
that represent them.

[NOTE]
====
When you run `virtctl` commands, you modify the virtual machines themselves,
not the virtual machine instances that represent them in the web console.
====

== start

Start a virtual machine.

.Example: Start a virtual machine in the current project
----
$ virtctl start <example-vm>
----

.Example: Start a virtual machine in a specific project
----
$ virtctl start <example-vm> -n <project_name>
----

== restart

Restart a running virtual machine.

.Example: Restart a virtual machine in the current project
----
$ virtctl restart <example-vm>
----

.Example: Restart a virtual machine in a specific project
----
$ virtctl restart <example-vm> -n <project_name>
----

== stop

Stop a running virtual machine.

.Example: Stop a virtual machine in the current project
----
$ virtctl stop <example-vm>
----

.Example: Stop a virtual machine in a specific project
----
$ virtctl stop <example-vm> -n <project_name>
----

== list

List the virtual machines or virtual machine instances in a project. The
virtual machine instances are abstractions that represent the virtual machines
themselves.

.Example: List the virtual machines in the current project
----
$ oc get vm
----

.Example: List the virtual machines in a specific project
----
$ oc get vm -n <project_name>
----

.Example: List the running virtual machine instances in the current project
----
$ oc get vmi
----

.Example: List the running virtual machine instances in a specific project
----
$ oc get vmi -n <project_name>
----
