Linux exit from lxc-console keyboard shortcut

Posted on in Categories , , last updated August 4, 2015

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?

You need to use the lxc-console command to log in to a running Linux container. The syntax is as follows:

lxc-console -n container-name
lxc-console -n webserver
lxc-console -n pgsql

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
Gif.01: How to disconnect from lxc-console demo

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

1 comment

Leave a Comment