Linux exit from lxc-console keyboard shortcut

last updated in Categories , ,

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, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

1 comment

    Have a question? Post it on our forum!