Linux kvm exit from a virsh console command

I installed KVM on Ubuntu server as described here. However, I am unable to get out of a ‘virsh console domain’ command. How can I exit from a “virsh console” connection over ssh based session? How do I exit a “virsh console” connection command on Linux KVM session?

You can use ‘virsh console vm’ command to connect the virtual serial console for the guest machine. The syntax is:
virsh console domain
virsh console vmNameHere
virsh console --domain vmNameHere --safe

To exit a virsh console from a shell prompt on Linux:

  1. Open a shell prompt or login using ssh.
  2. Login to a host server called server1.
  3. Use the virsh console command to log in to a running VM called ‘centos7’ type: virsh console centos7
  4. To exit a virsh console session, type CTRL+Shift followed by ].

How to exit a “virsh console”?

The keyboard shortcuts are as follows if you are using English keyboard i.e. Escape character is ^]:

  • CTRL+Shift+5
  • CTRL+Shift+]

Fig.01: Use special keyboard shortcuts to exit from a virsh console

More on virsh-console options

Type the following command:
$ virsh help console
Sample outputs:

    console - connect to the guest console
    console <domain> [--devname <string>] [--force] [--safe]
    Connect the virtual serial console for the guest
    [--domain] <string>  domain name, id or uuid
    --devname <string>  character device name
    --force          force console connection (disconnect already connected sessions)
    --safe           only connect if safe console handling is supported


Other recommended keyboard shortcuts for kvm exit from a virsh console command on Linux are as follows:

Escape character for KVM to exit Description/Used by
Ctrl+] English keyboard
Ctrl+5 Same as above
Ctrl+Shift+^~ Danish keyboard
Ctrl+Shift+5 French keyboard
Ctrl+Shift+$€* Same as above but for Mac computer
Ctrl+Shift+5 German keyboard
ctrl+alt+6 Same as above but for Apple macBook/computer
Ctrl+Shift+^¨~ Norwegian keyboard:
Ctrl+Shift+å Swedish keyboard for macOS

🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig 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
3 comments… add one
  • Tristan D Jan 2, 2017 @ 6:09

    At least for English/UK/US keyboard:

  • Tristan D Jan 2, 2017 @ 6:09

    At least for English/UK/US keyboard:

  • Mika Hakala Aug 26, 2020 @ 7:03

    For Finnish keyboard Ctrl+^

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @