How to find your public IP address from command-line?
+3
−0
ip a
command will conveniently show the addresses assigned to your network interfaces, but oftentimes this is not what the internet sees your machine as.
So how to find your public IP address from command-line?
3 answers
+1
−0
In case Ipify stops being free: https://dnsleaktest.com/ will show you your IP. I don't know if they have an API, but it's easy to parse the HTML:
https dnsleaktest.com | rg '\d+\.\d+\.\d+\.\d+' --only-matching
(the commands are https://httpie.io/ and https://github.com/BurntSushi/ripgrep)
0 comment threads
+2
−0
Works for me
The following users marked this post as Works for me:
User | Comment | Date |
---|---|---|
matthewsnyder | (no comment) | Dec 28, 2023 at 17:18 |
There are probably myriad services for echoing your IP back over HTTP. Here are a couple:
curl https://api.ipify.org
curl https://ip.me
curl https://icanhazip.com
1 comment thread