HowTo: Show IP of network interfaces on desktop


Forum: DSL Tips and Tricks
Topic: HowTo: Show IP of network interfaces on desktop
started by: ruserious

Posted by ruserious on Dec. 15 2005,12:29
torsmo is the system monitor on your desktop (starting with DSL 2.1). It can be customized to show plenty of additional stuff, I'll show how to customize it so it displays the IP(s) of your networkinterfaces.

Granted not very exciting, but I find it helpful, especially when I have to remote administer friends' DSL installs via ssh.

1. First we create a little shell script that outputs the IP for a given interface. Create a file ~/.myip with this content:
Code Sample

#!/bin/sh
ifconfig  $1 2>&1 | awk '/inet/ { gsub(/[a-z:[:space:]]/,"",$2);printf $2}'


2. chmod 775 ~/.myip to make it executable

3. Test if it's working with: ~/.myip eth0 or if you are on a PPPoE connection try ~/.myip ppp0
This should return one IP-Adress and the shell-prompt should appear right next to it.

4. If the above is ok, you can edit your torsmo-config file  ~/.torsmorc and add the output of this script to it. For example find the line that reads:
Code Sample

${color grey}Uptime$color $uptime

and replace it with:
Code Sample

${color grey}Uptime$color $uptime    IP: ${execi 60 ~/.myip eth0}

execi 60 will refresh the value every 60 seconds. Also we are passing the name of the interface, so if you wanted to, you could show multiple interfaces.

5. If you want to immediately see the changes you can pkill torsmo and restart it torsmo&

Posted by cbagger01 on Dec. 15 2005,18:04
Torsmo sounds like a really cool program that can be customized in endless ways if you think creatively like ruserious here.

Thank you for introducing me to both the specific tweak and also for opening my eyes a little more to the concept of tweaking this program.

Posted by roberts on Dec. 15 2005,19:32
dsl-2.1RC2 already has such a script.
Look for .torsmo_ip and the execi in the .torsmorc
See change log for dsl-2.1RC2.

But a good and thorough explaination.



Posted by ruserious on Dec. 15 2005,21:39
Oh, man! I feel officially stupid now. I had downloaded RC1, but hadn't had the time to play with it. And then I downloaded RC2, and when I finally had time to experiment, I was using RC1 thinking I was using RC2... :laugh:

Ok, give me some time, I'll find some way to give back to this great community. ;)

Posted by cbagger01 on Dec. 17 2005,03:53
You already have.

Just because it has already been done does not invalidate the effort, especially when it shows the other forum readers "how to do it" in concept.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.