Search This Blog

Thursday, January 29, 2009

एक्स्त्रक्टिंग IP address from ifconfig

ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | cut -d":" -f2
ifconfig eth0 | sed -n 's/.*inet addr:\([0-9.]*\).*/\1/p'

command get_def_addr will return ip address

2 comments: