Automatically setting the DISPLAY variable

Put one of the following in your ~/.profile and the DISPLAY variable will automatically be set to your client, no matter which client you're coming from, when you telnet in. Alternatively, you could put the command into /etc/profile and then it will work for all users on the system.

export DISPLAY=`who -mT|awk '{ print $9}'`:0

export DISPLAY=`who -m|awk '{print $6}'|tr -d \( | tr -d \)`:0