Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Poll system for IPs

Status
Not open for further replies.

w1nn3r

ISP
Sep 12, 2001
179
US
How can i poll the system for IP's configured on the system, i could use ifconfig | grep inet but i was looking for a more clean option. Also would there be a way to only display IPs that dont have a certain port open, like netstat -an | grep :8080 so that it only show's IPs without port 8080 open. Thanks for your help :)
 
#1:
Code:
/sbin/ifconfig | awk '
{
       if ( (p = match($0,/inet addr:[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/) ) > 0) {
          printf"Address found at: %s\n", substr($0,(RSTART + 10),(RLENGTH - 10)
)
     }
}'

#2
netstat -an | grep -v ":8080"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top