Script to get a localhost’s IP address in Linux

By | August 20, 2014

I’ll keep this snippet really short:

[text]
$ ifconfig eth0 | grep "inet addr:" | cut -d: -f2 | awk ‘{ print $1 }’
[/text]

Which results in:

[text]
10.X.X.X
[/text]

Leave a Reply

Your email address will not be published. Required fields are marked *