Linux环境中DISPLAY环境变量的解释及设置

时间:2023-03-09 13:06:38
Linux环境中DISPLAY环境变量的解释及设置

在Linux/Unix类操作系统上的GUI应用程序使用X Window系统(X Window System),它旨在允许多个用户使用窗口化的应用程序通过网络访问计算机。 DISPLAY环境变量用来设置将图形显示到何处。直接登录图形界面或者登录命令行界面后使用startx启动图形,DISPLAY环境变量自动设置为:0:0,此时可以打开终端,输入图形程序的名称(比如xclock)来启动程序, 图形将显示在本地窗口上。

在终端中输入可以通过如下命令DISPLAY设置情况。

1、echo $DISPLAY

2、printenv

3、xdpyinfo

设置DISPLAY环境变量:

[root@localhost ~]# export DISPLAY=:0.0
[root@localhost ~]# xhost +
access control disabled, clients can connect from any host
[root@localhost ~]#