Last active
May 23, 2020 18:00
-
-
Save zmarffy/c60a1c630e99d858840d9b32ae4075ab to your computer and use it in GitHub Desktop.
Display public and private IPs of your machine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Hostname is: $(hostname)" | |
echo "Public IP address is: $(dig +short myip.opendns.com @resolver1.opendns.com)" | |
echo "Private IP addresses are: $(hostname -I | sed 's/ /, /g' | sed 's/.\{2\}$//')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment