Skip to main content

Get IPs

There will be times when you need to get the IP addresses assigned to the computer you are logged in to.

PUB=$(curl -s ipinfo.io/ip) && PRI=$(hostname -I | awk '{print $1}') \
&& echo 'Public IP:' $PUB && echo 'Private IP:' $PRI