The virsh command can be used to mange local or remote guest operating systems. The program can be used to create, pause, and shutdown domains. It can also be used to list current domains.

List Running VMS

Type the following command:
# virsh list
Sample outputs:

 Id Name                 State
  1   running
  2 freebsd              running

Shut Down A Guest

# virsh list
# virsh shutdown dominName
# virsh shutdown freebsd
# virsh shutdown 3

Rebooting A Guest

# virsh list
# virsh reboot domaiName
# virsh reboot 3
# virsh reboot win2008biz

Forcefully Stop A Guest

Force a guest to stop with the virsh command if it is not responding or crashed
# virsh list
# virsh destroy domainName
# virsh destroy

Get Information About Guest

# virsh list
# virsh dominfo dominName
# virsh dominfo 2
# virsh dominfo freebsd

Sample outputs:

Id:             2
Name:           freebsd
UUID:           6b7f44df-b67a-b1e1-0f9a-40c9ad760b0a
OS Type:        hvm
State:          running
CPU(s):         1
CPU time:       26.3s
Max memory:     524288 kB
Used memory:    524288 kB
Autostart:      disable

Get Information About Node

# virsh nodeinfo
Sample Outputs:

CPU model:           x86_64
CPU(s):              4
CPU frequency:       2394 MHz
CPU socket(s):       1
Core(s) per socket:  4
Thread(s) per core:  1
NUMA cell(s):        1
Memory size:         8181332 kB


The first part in this series covered KVM installation, KVM bridged based networking, KVM guest setup using virt-install, virt-manager, kickstart based guest installation and troubleshooting KVM with log files. Stay tunned for next part of series which will cover other advanced topics such as:

  • VM storage configuration using NFS and iSCSI
  • VM live migration
  • VM security and firewall
  • VM load balancing
  • VM instillation using Cobbler
This entry is 8 of 14 in the CentOS / Redhat (RHEL) KVM Virtulization series. Keep reading the rest of the series:
  1. CentOS / Redhat: Install KVM Virtualization Software
  2. CentOS / Redhat: KVM Bridged Network Configuration
  3. KVM virt-manager: Install CentOS As Guest Operating System
  4. KVM virt-install: Install FreeBSD / CentOS As Guest Operating System
  5. KVM: Install CentOS / RHEL Using Kickstart File (Automated Installation)
  6. Troubleshooting KVM Virtualization Problem With Log Files
  7. KVM Virsh: Redirect FreeBSD Console To A Serial Port
  8. KVM: Starting / Stopping Guest Operating Systems With virsh Command
  9. Linux KVM: Disable virbr0 NAT Interface
  10. FreeBSD / OpeBSD Running in KVM Does Not Accept FTP Traffic
  11. KVM: Start a Virtual Machine / Guest At Boot Time
  12. KVM virt-install: Install OpenBSD As Guest Operating System
  13. Linux KVM: OpenBSD Guest Hangs At Starting tty Flags
  14. KVM Virtualization: Start VNC Remote Access For Guest Operating Systems

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 7 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
7 comments… add one
  • Michael Jun 16, 2010 @ 10:33

    I have been looking for this article. I was wanting to set up a virtual lab to practice for my RHCE and this article totally covers the pieces I was missing to make it work.

    Thank you.

  • Mike Jan 30, 2011 @ 22:54

    Any chance you can add an index to all of the articles in this series, linking them together?

    Would make it easy to navigate in order, rather than having to search the site and piece the order together.

    Not critical, but would put the series together. Good write-ups!

    • 🐧 nixCraft Jan 31, 2011 @ 20:46

      I will get an index and next and previous in series links added so that users can navigate easily.

  • muazfa Jul 18, 2011 @ 3:48

    Hi, when you want to write about VM load balancing? i’m very interesting about that

  • Thomas Dilts Feb 20, 2012 @ 10:35

    You forgot the all important:
    virsh start

  • alfie Jan 3, 2013 @ 16:13

    great post!
    have you finished the next part series, such as
    VM with NFS, iSCSI
    VM with load balance

  • Chris May 9, 2014 @ 12:19

    Starting / Stopping Guest Operating Systems With virsh Command >>> I don’t see how the helll you start another dead end seriously waste of time here

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum