Find your IP from Linux console

Find your IP from Linux console

For the last few years, Google has been offering an easy way to see your IP. Just Google “what is my ip” and you will be presented with the IP right the search results.

For users and developers working on something from a Linux device, without a browser, the story is different. This is why there are some simple API services that will provide you with your IP directly via curl or in json format.

IP-Api.com

With a simple command you will get all of your geo location information in a json response.

1
curl ip-api.com

Response example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
"country" : "Canada",
"countryCode" : "CA",
"region" : "BC",
"regionName" : "British Columbia",
"city" : "City Name",
"zip" : "V1X",
"lat" : 49.xxx,
"lon" : -121.xxx,
"timezone" : "America/Vancouver",
"isp" : "Shaw Communications",
"org" : "Shaw Communications",
"as" : "AS6327 Shaw Communications Inc.",
"mobile" : false,
"proxy" : false,
"query" : "xxx.xxx.xxx.xxx"
}

IfConfig.co

Will provide a much simpler response, with just your IP address. There are ways to get more data, similar to the previous site mentioned above.

Simple string response

1
curl ifconfig.co

Extended JSON response

1
curl ifconfig.co/json

More information: https://ifconfig.co/

More Content