ifconfig ppp0 | grep 'inet addr:' | sed 's/.*inet addr:\([0-9.]*\).*/\1/g' If your connection is via ethernet, just swap ppp0 above with eth0 or eth1 or whatever. The above will return just the ip address. For more general information on your interfaces, just use ifconfig.