How to retrieve the IP address with ip under Linux ?

In this story, you will learn how to retrieve the IP address with the ip command.

Ensure that ifconfig is installed :

sudo yum install net-tools

To show the interfaces of the system :

ip address show

lo is the loopback address. In general, it’s 127.0.0.1/8.

To filter a device :

ip address show dev eth1

The IPv4 address is listed in the line starting with inet.

Retrieve the IP address can be done like that :

ip address show dev eth1 | grep “inet “ | awk ‘{ print $2 }’

You can see that in video (in french …) on my Youtube channel DevOpsTestLab.

Bruno Delb, founder of the blog http://www.DevOpsTestLab.com.

Written by

Interests in the full lifecycle: design, Agile Coaching, development, testing, DevOps, Cloud, Management 3.0, ITIL. It defines me.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store