Can someone tell me what is the best way to get your ip address through a command line command.
cat /etc/hosts | grep `hostname` | awk '{print $1}'
gives 2 ip.
127.0.0.1 and actual ip address
while ifconfig -a gives a lot of information and its difficult to get ip address in between.
Is there is any direct command?