DEV Community

goffity
goffity

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

Discussion (0)