Sometimes you want to find out what your public IP address is. There are various ways of finding this out like Googling “my IP address”. My favourite is ifconfig.co.
Not only does it display detailed information of your current connection in a simple and vanilla layout.
alastair@ubuntu:~$ curl ifconfig.co/ip 185.245.87.234
Using jq you can display more information in a useful layout..
alastair@ubuntu:~$ curl ifconfig.co/json | jq
{
"ip": "185.245.87.234",
"ip_decimal": 3119863786,
"country": "United States",
"country_eu": true,
"country_iso": "US",
"city": "Los Angeles",
"hostname": "no-mans-land.m247.com",
"latitude": 34.0549,
"longitude": -118.2578,
"asn": "AS9009",
"asn_org": "M247 Ltd",
"user_agent": {
"product": "Mozilla",
"version": "5.0",
"comment": "(Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36",
"raw_value": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36"
}
}