Last Updated: February 25, 2016
·
357
· jgrenon

Retrieve IP address automatically

ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1;}'

You can add this to any command line requiring your IP address by using back ticks.

`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1;}'`