If you want to know your outgoing public IP address, you could go to google and search "what's my ip", google will show your IP address.
If you don't want to use google, you could just use the command line. Two ways listed below (tested in Linux and MacOS):
1st way:
$ dig +short myip.opendns.com @resolver1.opendns.com
2nd way:
$ curl ifconfig.co/
For faster access, you could just put an alias in your shell config, e.g. ~/.bashrc
or ~/.zshrc
:
alias myip='curl ifconfig.co/'
Next time you can just open your terminal then run:
$ myip
$ 67.83.127.63
Top comments (1)
We can also use other third-party services to query the public IP on our host:
And we can use the
host
command to resolve OpenDNS service on our host to get the current public IP address: