What is the command to find my global IP address?

Asked 2 years ago, Updated 2 years ago, 49 views

Is there a command that checks the global IP address that I used to connect to only the command line without using a browser?

linux

2022-09-30 21:11

2 Answers

$curl inet-ip.info/ip
116.64.92.65

Now you can check it out

JSON format is here

$curl inet-ip.info/json
{"IP":"116.64.92.65","Hostname":"[116-64-92-65.rev.home.ne.jp.]","CountryCode":"JP","CountryName":"Japan","Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"],"AcceptEncoding":["gzip, deflate, sdch"],"AcceptLanguage":["en-US,en;q=0.8,ja;q=0.6"],"UserAgent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36(KHTML, like Gecko) Chrome/49.0.2623.75 Safari/537.36", "Via":[1.1 vegur], "XForwardedFor":[116.64.92.65"], "XForwardedPort":[80", "XForwardedProto":["http", "RequestURI"/":}


2022-09-30 21:11

httpbin.org is recommended because you can check various HTTP responses in addition to looking up IP addresses.

$curl httpbin.org/ip

Also, there seems to be a way to find the current IP address from DNS (Reference)

$dig o-o.myaddr.l.google.com@n s1.google.com txt+short
$ dig [email protected] + short


2022-09-30 21:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.