Checkhostname is a handy utility for doing name-to-IP (gethostbyname) and IP-to-name (gethostbyaddr) lookups, or plausibility checks, from a shell script. It's from the DIET-PC embedded Linux distribution. Compile using "gcc $CFLAGS -o checkhostname checkhostname.c".