1837149 Members
2252 Online
110112 Solutions
New Discussion

X-Terminal Name/IP

 
SOLVED
Go to solution
David Whitehead
Advisor

X-Terminal Name/IP

How can I get a display terminal's IP address or name (suitable to put into DISPLAY=xxxxxxxxx:0.0) dynamically?

The display in question is not the 'hostname'. I am sure I have seen this done but cannot for the life of me remember how to get it.

Thanks in advance.

David
6 REPLIES 6
R.Suresh
Frequent Advisor

Re: X-Terminal Name/IP

Hi,

Write a shell script like


echo "Enter the display server IP"
read xxx
export DISPLAY=$xxx:0.0
export TERM=dtterm
echo "echo DISPLAY exported"

Thanks & Regards
R.Suresh.
r_sures@yahoo.com
PDLS
Kofi ARTHIABAH
Honored Contributor
Solution

Re: X-Terminal Name/IP

Try:

myhost=`who -mRu | awk '{ print $8 }'`
DISPLAY=$myhost:0.0 ; export DISPLAY

cheers.
nothing wrong with me that a few lines of code cannot fix!
David Whitehead
Advisor

Re: X-Terminal Name/IP

Ah, I meant without any user interaction, in the same way that this works:

export DISPLAY=`hostname`:0.0

but the DISPLAY I want to export is that of an X-Terminal.

Apologies for my lack of clarity :)

David
Rick Garland
Honored Contributor

Re: X-Terminal Name/IP

Once you find out what the IP is of the X-term can put into DNS. This will allow you to
input the command export DISPLAY=:0.0

David Whitehead
Advisor

Re: X-Terminal Name/IP

Kofi,

Thanks friend - you hit the nail on the head :)
Thanks everyone else too.

David
P V Patel
Advisor

Re: X-Terminal Name/IP

You may use arp -a command also to get ip address.
P V Patel
Punjabhai