Public ip and geo location via Linux CLI

use the script below to display you IP and geo location.

open a file in linx, paste the content below; e.g myip.sh

#!/bin/bash
dig +short myip.opendns.com @resolver1.opendns.com. | curl ipinfo.io/

Assign execution permissions to the file

chmod a+x myip.sh

Execute the file and view results;

./myip.sh

{
 "ip": "185.100.87.26",
 "hostname": "bunker.in.net",
 "city": "Bucharest",
 "region": "Bucuresti",
 "country": "RO",
 "loc": "44.4333,26.1000",
 "org": "AS200651 FlokiNET ehf",
 "postal": "001553"
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s