@saji
ifconfig
if obsolete, please use iproute2
;^). The command would be ip -o -4 a s eth0 | awk '{sub(/\/.*/, "", $4);print $4}'
.