Showing results for 
Search instead for 
Did you mean: 

Lost DISPLAY variable

Lost DISPLAY variable

My maschine lost it`'s DISPLAY variable.
echo $DISPLAY gives no output.
How can I set the DISPLAY variable permantent ?
Marc Dijkstra
Trusted Contributor

Re: Lost DISPLAY variable

You must check your .profile (or whichever shell login you are using or /etc/PROFILE and check that the DISPLAY is set up.

Make sure that uname -a knows the hostname, as you need to run:
# export DISPLAY=`hostname`:0.0

If the hostname is unknown or mixed up, it will mess up the DISPLAY variable..

"A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila"
Bill Hassell
Honored Contributor

Re: Lost DISPLAY variable

There is nothing magic about $DISPLAY. It needs to be set each time you do a 'normal' login. Here's a script snippet you can include in your .profile that wil always set it automatically:

export DISPLAY="$(/usr/bin/who -muR | /usr/bin/awk '{print $NF}'):0.0"

This will as long as you are adjacent and not logged through 2 or more additional systems.

Bill Hassell, sysadmin