LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-11-2012, 05:27 PM   #1
SoybeanStasher
LQ Newbie
 
Registered: Mar 2012
Posts: 2

Rep: Reputation: Disabled
DISPLAY=:0.0 vs DISPLAY=localhost:0.0


I'm trying to learn more about X11. Omitting the hostname from the DISPLAY variable should imply the server is running locally, yes?

From a terminal running in Ubuntu:
Code:
$ echo $DISPLAY
:0.0
Run 'xeyes' and the window pops up fine. But neither of the following work:
Code:
$ DISPLAY=localhost:0.0 xeyes
Error: Can't open display: localhost:0.0
Code:
$ DISPLAY=127.0.0.1:0.0 xeyes
Error: Can't open display: 127.0.0.1:0.0
Can someone elaborate on why this is?
 
Old 03-11-2012, 05:52 PM   #2
eeekster
Member
 
Registered: Sep 2011
Posts: 163

Rep: Reputation: Disabled
With DISPLAY=localhost:0.0 you are asking to connect to an X11 server via TCP. Your X server is most likely not listening on a TCP socket.
 
1 members found this post helpful.
Old 03-12-2012, 03:27 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 16,678

Rep: Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455
I never did get what the OP was asking.

echo something is you telling the system to report. In the first case it is the name of the terminal but that may be that hostname file is not set.

Set it and your terminal ought to then say the name and the ending such as myscreen:0 or on some systems myscreen:0.0

Then run xeyes -diaplay myscreen:0
 
Old 03-12-2012, 05:48 PM   #4
eeekster
Member
 
Registered: Sep 2011
Posts: 163

Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
I never did get what the OP was asking.

echo something is you telling the system to report. In the first case it is the name of the terminal but that may be that hostname file is not set.

Set it and your terminal ought to then say the name and the ending such as myscreen:0 or on some systems myscreen:0.0

Then run xeyes -diaplay myscreen:0
It doesn't matter what you say in the host file if X isn't listening on a TCP/IP socket and the normal usage is to not do so.
 
Old 03-12-2012, 06:48 PM   #5
verigoth
Member
 
Registered: May 2002
Posts: 179

Rep: Reputation: Disabled
Run 'xhost +localhost' first. Be careful with xhost..as eeekster eluded to it's generally not a good idea to listen for X connections on TCP.
 
Old 03-12-2012, 07:51 PM   #6
eeekster
Member
 
Registered: Sep 2011
Posts: 163

Rep: Reputation: Disabled
Quote:
Originally Posted by verigoth View Post
Run 'xhost +localhost' first. Be careful with xhost
That only adds permission for localhost; it does not cause the X server to start listening on an IP socket.

Quote:
as eeekster eluded to it's generally not a good idea to listen for X connections on TCP.
Used to have fun with people at work that didn't restrict access on the Windows based X servers.
 
Old 03-12-2012, 09:12 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 16,678

Rep: Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455
should be hostfile not host file.

the echo $DISPLAY :0 proves that there is no name on that terminal.

I assumed that the OP has a gui running such as kde or gnome or such. That may be wrong.

Last edited by jefro; 03-12-2012 at 09:14 PM.
 
Old 03-20-2012, 03:12 PM   #8
SoybeanStasher
LQ Newbie
 
Registered: Mar 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
I actually did have /etc/hostname set (if that's what you meant), but that doesn't seem to affect whether $DISPLAY contains the hostname or not. This, however:
Quote:
Originally Posted by eeekster View Post
With DISPLAY=localhost:0.0 you are asking to connect to an X11 server via TCP. Your X server is most likely not listening on a TCP socket.
helped immensely, since I found this and was able to get a TCP connection (working on an X11 proxy for input fuzzing).

Thanks very much!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
xwd: unable to open display 'localhost:15.0' laredotornado Linux - General 1 07-07-2011 01:18 PM
Can't Open Display localhost:0.0 garethnsolomons Linux - Newbie 2 04-01-2011 12:54 AM
Can't open display: localhost:0.0 shpatil Linux - Newbie 2 12-01-2010 09:29 AM
hp compaq presario v3412tu no display on laptop screen, just external display y33_4nn Linux - Laptop and Netbook 2 02-08-2010 11:33 PM
how do I display localhost ip address as a standard user blackdragonblood Linux - Networking 7 03-10-2006 06:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration