- VisualStudio2022插件的安装及使用-编程手把手系列文章
- pprof-在现网场景怎么用
- C#实现的下拉多选框,下拉多选树,多级节点
- 【学习笔记】基础数据结构:猫树
最近遇到个两年前遇到的问题,使用virt-manager提示(virt-manager:873): Gtk-WARNING **: 14:53:28.147: cannot open display: :1,当时专门运维的同事帮忙临时调了下DISPLAY变量,好像是将:1改成了SSH用户本地IP:10.0,当时的确好了,用完就关了再没用到,也没深究原因,那个运维同事也不大理解(网上查到的解决办法)。然而最近在做资产盘点,领导让我把我挂名管理的服务器作置换申请,需要知道虚拟机的信息,赶上盘到两年前有问题的机器上,又出现同样的问题,经过查找了资料找到了个几乎万无一失的理解,记一记.
首先,它是Linux X11 server(显示服务)用到的一个环境变量,用来指示你的显示(也可以包含键盘和鼠标)指向的显示服务地址,通常桌面PC该值会被设为:0.0 .
其次,它的格式有三部分: [主机名]:显示服务端口号-6000.显示器编号 。
[主机名]
:一般是可以省略的,可以不写,也可以写成$HOSTNAME
变量表示的主机名 或 localhost显示服务端口号-6000
:意思是sshd服务的X11Forwarding占用端口减去6000的值显示器编号
:一般都是0,表示第一个显示器分两种情况:
:0.0
检查步骤如下:
[root@hz ~]# netstat -anpt |grep sshd |grep LISTEN |grep 60
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 30346/sshd: root@pt
tcp6 0 0 ::1:6010 :::* LISTEN 30346/sshd: root@pt
找到60开头的sshd端口,这时是6010,减去6000是10,SSH只写第一显示器编号 。
则我的DISPLAY变量可设为 :10.0 或者 hz:10.0 。
如果上边的命令查不出来6000左右的端口号,请检查 /etc/ssh/sshd_config,确认X11Forwarding yes参数已配置并systemctl restart sshd,使用exit退出当前ssh,重新连接再尝试.
The magic word in the X window system is DISPLAY. A display consists (simplified) of
A display is managed by a server program, known as an X server. The server serves displaying capabilities to other programs that connect to it. 。
The remote server knows where it has to redirect the X network traffic via the definition of the DISPLAY environment variable which generally points to an X Display server located on your local computer. 。
The value of the display environment variable is
hostname:D.S
where
hostname is the name of the computer where the X server runs. An omitted hostname means the localhost. 。
D is a sequence number (usually 0). It can be varied if there are multiple displays connected to one computer. 。
S is the screen number. A display can actually have multiple screens. Usually, there's only one screen though where 0 is the default. 。
Example of values 。
localhost:4
google.com:0
:0.0
hostname:D.S means screen S on display D of host hostname; the X server for this display is listening at TCP port 6000+D. 。
host/unix:D.S means screen S on display D of host host; the X server for this display is listening at UNIX domain socket /tmp/.X11-unix/XD (so it's only reachable from host). 。
:D.S is equivalent to host/unix:D.S, where host is the local hostname. 。
:0.0 means that we are talking about the first screen attached to your first display in your local host 。
Read more here: support.objectplanet.com and here: superuser.com and here: docstore.mik.ua. 。
From a X(7) man page
From the user's perspective, every X server has a display name of the form
hostname:displaynumber.screennumber 。
This information is used by the application to determine how it should connect to the server and which screen it should use by default (on displays with multiple monitors)
hostname The hostname specifies the name of the machine to which the display is physically connected. If the hostname is not given, the most efficient way of communicating to a server on the same machine will be used. displaynumber The phrase "display" is usually used to refer to a collection of monitors that share a common keyboard and pointer (mouse, tablet, etc.). Most workstations tend to only have one keyboard, and therefore, only one display. Larger, multi-user systems, however, frequently have several displays so that more than one person can be doing graphics work at once. To avoid confusion, each display on a machine is assigned a display number (beginning at 0) when the X server for that display is started. The display number must always be given in a display name. screennumber Some displays share a single keyboard and pointer among two or more monitors. Since each monitor has its own set of windows, each screen is assigned a screen number (beginning at 0) when the X server for that display is started. If the screen number is not given, screen 0 will be used. 。
最后此篇关于彻底理解Linux的DISPLAY变量的作用的文章就讲到这里了,如果你想了解更多关于彻底理解Linux的DISPLAY变量的作用的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
除了 Display.getOrientation() 已弃用之外,Display.getRotation() 和 Display.getOrientation() 之间还有什么区别? 是否都返回等于
我的问题 这些方法中有哪一种是专业网页设计师所偏爱的吗? Web 浏览器在绘制网站时是否首选这些方法中的任何一种? 这只是个人喜好吗? 我还缺少其他技巧吗? 注意:以上问题是关于设计多列布局 floa
我的问题 专业网页设计师是否喜欢这些方法? 网页浏览器在绘制网站时是否首选这些方法? 这只是个人喜好吗? 我还缺少其他技术吗? 注意:以上问题与设计多列布局有关 float :左; http://js
我有一些代码返回 MyTrait 类型的特征对象,这样它就可以返回几个不同结构之一。我想为 trait 对象实现 Display trait,这样我就可以打印对象,并将详细信息委托(delegate)
package polymorphism; /* * @author Rahul Tripathi */ public class OverLoadingTest { /** *
我希望 Display.timerExec(int,Runnable)与 Display.asyncExec(Runnable) 大致相同但有指定的延迟。然而,似乎Display.timerExec只
就像标题所暗示的,有什么区别吗?我当时使用的是pygame.display.flip,我在互联网上看到的是,他们使用pygame.display.update而不是使用flip。哪一个更快? 最佳答案
Sample.this.display() 和 this.display() 哪个更好? class Sample{ void display(){ System.out.println("d
当图像的 CSS 属性“显示”已被任何其他 JS 脚本/函数更改时,我想运行一些 JS 代码。有什么方法可以监视该更改并设置回调函数吗? $(this).bind.('propertychange',
在浏览 Google 字体时我注意到第一个过滤器包含这些类别: Serif Sans 衬线 展示 手写 我知道什么是 (Sans)Serif 和 Handwriting 类别(这很明显)但是显示类别过
我想知道是否可以在列标记内渲染自定义 html,这是显示表标记的一部分。 例如,我希望我的专栏里面有一些下拉列表? 使用纯 html,如下所示: ... Volvo Saab Me
display.newImage() 和 display.newImageRect() 有什么区别? 哪个更好用? 最佳答案 display.newImage() 的文档具体提到: NOTE: dis
我正在使用纯 JS 和 flexbox 为我的元素创建网格。 元素的某些部分在页面加载时被显示隐藏:无,但单击按钮后它应该在不显示和阻止之间切换。 可悲的是,这完全破坏了 display: flex
我目前正在参加 HTML/CSS 类(class),这本书推荐我使用.desktop {display:none;}/.mobile {display:inline;} 以及div class="de
这个问题在这里已经有了答案: Css transition from display none to display block, navigation with subnav [duplicat
我理解 style="display: none" 隐藏一个 HTML 元素,而 style="display: block" 显示一个 block 级 HTML 元素。 我看到一些使用 style=
设置控件的样式 display: none 和 display: block 有什么区别? 最佳答案 display 属性定义了某个 HTML 元素应该如何显示。 Display block 和 no
这个问题已经有答案了: Javascript AND operator within assignment (7 个回答) 已关闭 4 年前。 假设我只想在 this.state.display 为
我不确定如何命名这个问题,因为我是 Rust 新手,所以请随意提出修改建议。 我有两个结构。一个是 Job 结构,其中包含一些数字,例如作业需要多长时间等。另一个是 JobSequence,其中包含
我不确定如何命名这个问题,因为我是 Rust 新手,所以请随意提出修改建议。 我有两个结构。一个是 Job 结构,其中包含一些数字,例如作业需要多长时间等。另一个是 JobSequence,其中包含
我是一名优秀的程序员,十分优秀!