Linux exit from lxc-console keyboard shortcut

I‘m using Debian Linux server with Linux Containers (lxc). How do I disconnect and exit from an lxc-console to a shell prompt without closing ssh session?

Linux Containers (LXC) is an operating-system-level virtualization method for running multiple isolated Linux systems (containers) on a control host using a single Linux kernel. You need to use the lxc-console command or lxc console {container} command to log in to a running Linux container. The syntax is as follows:
Tutorial details
Difficulty level Easy
Root privileges No
Requirements lxc
Est. reading time Less than a minute

lxc-console -n container-name
lxc-console -n webserver
lxc-console -n pgsql
lxc console c1-www
lxc console nginx-container

To exit an lxc-console from a shell prompt:

  1. Open a shell prompt.
  2. Login to a host server called server1.
  3. Use the lxc-console command to log in to a running container called ‘memcache’ type: lxc-console -n memcache
  4. To exit an lxc-console session, type Ctrl-A followed by Q.

Here is a sample session:

Gif.01: How to disconnect from lxc-console demo

How do I exit from LXD based ‘lxc console’ session

LXD is a next generation system container manager. It offers a user experience similar to virtual machines but using Linux containers instead. The syntax is as follows:

  1. Open terminal window
  2. Another option is to log in into remote LXD server
  3. Use the ‘lxc console’ to log into a running container called ‘arch’: lxc console arch
  4. To detach and exit from the ‘lxc console’ command, press: <CTRL>+a q

Here is a sample session that shows how to disconnect from lxc console command from LXD:

LXD isn’t a rewrite of LXC, in fact it’s building on top of LXC to provide a new, better user experience. Under the hood, LXD uses LXC through liblxc and its Go binding to create and manage the containers. It’s basically an alternative to LXC’s tools and distribution template system with the added features that come from being controllable over the network.


You learned how to exit from lxc-console and ‘lxc console’ commands by pressing various command line under when using Linux containers such as lxc/LXD.

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

🐧 1 comment so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
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
1 comment… add one
  • huseyin May 28, 2015 @ 18:38

    thank you so much!

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