What's the IP number?

If you’re jumping around on servers and need to figure out what the IPnumber(s) of the server are, here’s a little bash line which usually works (tough with a few catches):

ifconfig eth0 | grep inet | awk '{ print $2 }'

This command assume the eth0 is the public WAN interface in the server. If there are more network cards this may not be correct - or the only interface for the net.

The line may list one or more IPnumbers - as you can have an IPv4 and IPv6 on the same network interface.