← 返回命令列表

Linux command

lxc-console 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Connect

sudo lxc-console container_name

Example

sudo lxc-console -t 1 container_name

Exit

Ctrl+a q

Example

lxc-console --help

说明

lxc-console launches a console for the specified container. It connects to a tty device provided by the container's init system, allowing interactive access.

参数

-n, --name NAME
Name of the container to connect to
-t, --tty N
Connect to tty number N instead of an available one
-e, --escape CHAR
Set escape character (default: 'a' for Ctrl+a)
-P, --lxcpath PATH
Use alternate container path
-?, --help
Display help information

FAQ

What is the lxc-console command used for?

lxc-console launches a console for the specified container. It connects to a tty device provided by the container's init system, allowing interactive access.

How do I run a basic lxc-console example?

Run `sudo lxc-console container_name` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -n, --name NAME do in lxc-console?

Name of the container to connect to