Showing results for 
Search instead for 
Did you mean: 

$DISPLAY not getting set

Occasional Advisor

$DISPLAY not getting set

I have recently installed RedHat 8 on my PC. But when I run the 'Terminal' program my DISPLAY doesn't get set to <0.0>.

I get following
[root@gardner] # echo $DISPLAY

What's going wrong ?
If you can't change it, enjoy it !!
Eugen Cocalea_1
Occasional Advisor

Re: $DISPLAY not getting set

Is hostname set? What does 'hostname' command report?
It's not a shame to be born stupid. It's a shame to die being stupid.
Steven E. Protter
Exalted Contributor

Re: $DISPLAY not getting set

If hostname is correctly set, you can set the display in .bash_profile (not sure I spelled that right) or /etc/profile. If its a pc, it will work.

In reality you don't need a hostname set to use red hat in graphical mode. You can set display by IP address.

export DISPLAY

make sure the IP address is up on a network device like eth0

Steven E Protter
Owner of ISN Corporation
John Meissner
Esteemed Contributor

Re: $DISPLAY not getting set

you can also use your hostname to set your display


or if you're telnetting into another server you can set your display by running this script:

var1=$(who -mT | sed -e 's/.*[ ]\([^ ]*\)$/\1/')
export DISPLAY=$var1:0.0

All paths lead to destiny
Rick Beldin
Esteemed Contributor

Re: $DISPLAY not getting set

XOpenDisplay() recognizes :0.0 as referencing the local display (console). The hostname is not needed in the local display mode, and XOpenDisplay() can actually (and sometimes does) enable different transport mechanisms depending on how the DISPLAY is set up.

A local display could mean that it would use a more efficient transport, such as shared memory, as opposed to using TCP sockets, which have to go through name resolution and what not.

You also may find that under Linux some of the utilities do not enable TCP sockets for security reasons. For example, xfs (fontserver) doesn't enable socket connections from outside the box in the default mode.
Necessary questions: Why? What? How? When?