DEV Community

Goffity Corleone
Goffity Corleone

Posted on

Get IP and subnet on Linux

How to get public IP with subnet on Linux OS.

ip a | grep $(hostname -I | awk '{print $1}') | awk '{print $2}'
Enter fullscreen mode Exit fullscreen mode

Top comments (0)