IP to Country console commandGet my country by IP in bashHow to disable VLC output in command-line mode?how...
Exact functors and derived functors
Am I legally required to provide a (GPL licensed) source code even after a project is abandoned?
How hard is it to distinguish if I am given remote access to a virtual machine vs a piece of hardware?
Draw a symmetric alien head
Why don't we have a weaning party like Avraham did?
What is the oldest commercial MS-DOS program that can run on modern versions of Windows without third-party software?
Explicit song lyrics checker
Are there any individual aliens that have gained superpowers in the Marvel universe?
What triggered jesuits' ban on infinitesimals in 1632?
Rejecting an offer after accepting it just 10 days from date of joining
When Bnei Yisroel travelled in the midbar, what happened on Shabbos?
Dates on degrees don’t make sense – will people care?
What is "industrial ethernet"?
Can the pre-order traversal of two different trees be the same even though they are different?
A word for delight at someone else's failure?
Is there a name for the trope when there is a moments dialogue when someone pauses just before they leave the room?
Why is it easier to balance a non-moving bike standing up than sitting down?
How did the Vostok ejection seat safely eject an astronaut from a sealed space capsule?
I just entered the USA without passport control at Atlanta airport
Is the continuity test limit resistance of a multimeter standard?
Cut the gold chain
Covering index used despite missing column
How do internally carried IR missiles acquire a lock?
How does DC work with natural 20?
IP to Country console command
Get my country by IP in bashHow to disable VLC output in command-line mode?how to list all the internet's IP ranges?SUSE Linux 12 - configuring IP aliasHiding Your IP on Linuxcommand to enhance console lines with historyHow to track my public IP address in a log file?Is there a way to find self's dynamic public ip address using cli in Debian?How to scan IP address for hardware information?Is there something like Turnkey Linux configuration console out there?Get the domain name from IP address
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Is there a console command that takes an IP address as an input and shows its geographical information like city, country, ISP, etc.?
command-line ip
add a comment |
Is there a console command that takes an IP address as an input and shows its geographical information like city, country, ISP, etc.?
command-line ip
add a comment |
Is there a console command that takes an IP address as an input and shows its geographical information like city, country, ISP, etc.?
command-line ip
Is there a console command that takes an IP address as an input and shows its geographical information like city, country, ISP, etc.?
command-line ip
command-line ip
edited Feb 14 '11 at 20:02
Gilles
559k13411471657
559k13411471657
asked Feb 14 '11 at 19:22
BuZainBuZain
193126
193126
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
The command is the easy part, the difficult part is having access to a database.
For example, Ubuntu has a free database with a command line query tool (geoiplookup
) in the geoip-bin
package. But it only shows country information, and uses a static (hence out-of-date) database. This tool can also query the MaxMind GeoIP database, if you have a subscription there.
There are various GeoIP databases that you can look up. They're generally meant to be viewed through a web browser, but you can look for a scraping script. For example, here's a ruby script to retrieve data from the MaxMind database. Note that scraping may be against the database's terms of service.
1
just used the ubuntu geoiplookup and it is good enough.
– BuZain
Feb 15 '11 at 17:57
CentOS# yum install GeoIP
– zmonteca
Jul 1 '14 at 22:50
@StephenRauch Thanks but please use the official replacement for the broken bit.ly link: hostmar.co/software-small
– Gilles
Apr 3 '17 at 0:23
1
@StephenRauch The apt link only works with a browser plug-in that's part of the default Ubuntu installation but rarely installed otherwise.
– Gilles
Apr 3 '17 at 0:29
These are in Homebrew for Mac as well:geoipupdate; geoiplookup ...
– Pysis
Nov 25 '18 at 17:06
|
show 1 more comment
This trick is even nicer and doesn't require any external packages:
curl ipinfo.io/23.66.166.151
2
In case ipinfo.io gets offline someday, ifconfig.me provides a similar service (plus a REST-like API). But ifonfo.io seems much faster.
– cedbeu
Mar 5 '15 at 15:48
1
$ host yourdomain.com | cut -d ' ' -f 4 | curl ipinfo.io/$1
– zmonteca
Mar 22 '16 at 15:57
2
ipinfo.io is free for 1000 requests/day (see their pricing documentation).
– Matthieu
Nov 14 '16 at 15:03
4
Another alternative:curl ipinfo.io/$(dig +short yourdomain.com)
– John Red
Dec 7 '16 at 17:00
2
If someone ever hits the ceiling on the ipinfo.io API (lucky you?), there is also freegeoip.net which has a mind-blowing 15,000 requests per hour limit. (Which under the hood seems to be running the geoiplookup from the other answers)
– samthecodingman
Mar 9 '17 at 13:52
|
show 4 more comments
Here's another great option. Instructions here: http://kbeezie.com/geoiplookup-command-line/
For example, on Centos:
$ sudo yum install GeoIP GeoIP-data
$ geoiplookup 8.8.4.4
Works perfectly.
And of course, you can always set this up as a cron:
$ /usr/bin/geoipupdate
geoipupdate
is a MaxMind tool, you need a subscription and the licence key on/etc/GeoIP.conf
. I couldn't use the free alternative (Received an unexpected HTTP status code of 401).
– Pablo Bianchi
Mar 9 '18 at 22:47
add a comment |
Or use whois
$ whois 8.8.8.8 |grep country -i -m 1 |cut -d ':' -f 2 |xargs
US
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f7399%2fip-to-country-console-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
The command is the easy part, the difficult part is having access to a database.
For example, Ubuntu has a free database with a command line query tool (geoiplookup
) in the geoip-bin
package. But it only shows country information, and uses a static (hence out-of-date) database. This tool can also query the MaxMind GeoIP database, if you have a subscription there.
There are various GeoIP databases that you can look up. They're generally meant to be viewed through a web browser, but you can look for a scraping script. For example, here's a ruby script to retrieve data from the MaxMind database. Note that scraping may be against the database's terms of service.
1
just used the ubuntu geoiplookup and it is good enough.
– BuZain
Feb 15 '11 at 17:57
CentOS# yum install GeoIP
– zmonteca
Jul 1 '14 at 22:50
@StephenRauch Thanks but please use the official replacement for the broken bit.ly link: hostmar.co/software-small
– Gilles
Apr 3 '17 at 0:23
1
@StephenRauch The apt link only works with a browser plug-in that's part of the default Ubuntu installation but rarely installed otherwise.
– Gilles
Apr 3 '17 at 0:29
These are in Homebrew for Mac as well:geoipupdate; geoiplookup ...
– Pysis
Nov 25 '18 at 17:06
|
show 1 more comment
The command is the easy part, the difficult part is having access to a database.
For example, Ubuntu has a free database with a command line query tool (geoiplookup
) in the geoip-bin
package. But it only shows country information, and uses a static (hence out-of-date) database. This tool can also query the MaxMind GeoIP database, if you have a subscription there.
There are various GeoIP databases that you can look up. They're generally meant to be viewed through a web browser, but you can look for a scraping script. For example, here's a ruby script to retrieve data from the MaxMind database. Note that scraping may be against the database's terms of service.
1
just used the ubuntu geoiplookup and it is good enough.
– BuZain
Feb 15 '11 at 17:57
CentOS# yum install GeoIP
– zmonteca
Jul 1 '14 at 22:50
@StephenRauch Thanks but please use the official replacement for the broken bit.ly link: hostmar.co/software-small
– Gilles
Apr 3 '17 at 0:23
1
@StephenRauch The apt link only works with a browser plug-in that's part of the default Ubuntu installation but rarely installed otherwise.
– Gilles
Apr 3 '17 at 0:29
These are in Homebrew for Mac as well:geoipupdate; geoiplookup ...
– Pysis
Nov 25 '18 at 17:06
|
show 1 more comment
The command is the easy part, the difficult part is having access to a database.
For example, Ubuntu has a free database with a command line query tool (geoiplookup
) in the geoip-bin
package. But it only shows country information, and uses a static (hence out-of-date) database. This tool can also query the MaxMind GeoIP database, if you have a subscription there.
There are various GeoIP databases that you can look up. They're generally meant to be viewed through a web browser, but you can look for a scraping script. For example, here's a ruby script to retrieve data from the MaxMind database. Note that scraping may be against the database's terms of service.
The command is the easy part, the difficult part is having access to a database.
For example, Ubuntu has a free database with a command line query tool (geoiplookup
) in the geoip-bin
package. But it only shows country information, and uses a static (hence out-of-date) database. This tool can also query the MaxMind GeoIP database, if you have a subscription there.
There are various GeoIP databases that you can look up. They're generally meant to be viewed through a web browser, but you can look for a scraping script. For example, here's a ruby script to retrieve data from the MaxMind database. Note that scraping may be against the database's terms of service.
edited Apr 3 '17 at 0:22
answered Feb 14 '11 at 20:01
GillesGilles
559k13411471657
559k13411471657
1
just used the ubuntu geoiplookup and it is good enough.
– BuZain
Feb 15 '11 at 17:57
CentOS# yum install GeoIP
– zmonteca
Jul 1 '14 at 22:50
@StephenRauch Thanks but please use the official replacement for the broken bit.ly link: hostmar.co/software-small
– Gilles
Apr 3 '17 at 0:23
1
@StephenRauch The apt link only works with a browser plug-in that's part of the default Ubuntu installation but rarely installed otherwise.
– Gilles
Apr 3 '17 at 0:29
These are in Homebrew for Mac as well:geoipupdate; geoiplookup ...
– Pysis
Nov 25 '18 at 17:06
|
show 1 more comment
1
just used the ubuntu geoiplookup and it is good enough.
– BuZain
Feb 15 '11 at 17:57
CentOS# yum install GeoIP
– zmonteca
Jul 1 '14 at 22:50
@StephenRauch Thanks but please use the official replacement for the broken bit.ly link: hostmar.co/software-small
– Gilles
Apr 3 '17 at 0:23
1
@StephenRauch The apt link only works with a browser plug-in that's part of the default Ubuntu installation but rarely installed otherwise.
– Gilles
Apr 3 '17 at 0:29
These are in Homebrew for Mac as well:geoipupdate; geoiplookup ...
– Pysis
Nov 25 '18 at 17:06
1
1
just used the ubuntu geoiplookup and it is good enough.
– BuZain
Feb 15 '11 at 17:57
just used the ubuntu geoiplookup and it is good enough.
– BuZain
Feb 15 '11 at 17:57
CentOS# yum install GeoIP
– zmonteca
Jul 1 '14 at 22:50
CentOS# yum install GeoIP
– zmonteca
Jul 1 '14 at 22:50
@StephenRauch Thanks but please use the official replacement for the broken bit.ly link: hostmar.co/software-small
– Gilles
Apr 3 '17 at 0:23
@StephenRauch Thanks but please use the official replacement for the broken bit.ly link: hostmar.co/software-small
– Gilles
Apr 3 '17 at 0:23
1
1
@StephenRauch The apt link only works with a browser plug-in that's part of the default Ubuntu installation but rarely installed otherwise.
– Gilles
Apr 3 '17 at 0:29
@StephenRauch The apt link only works with a browser plug-in that's part of the default Ubuntu installation but rarely installed otherwise.
– Gilles
Apr 3 '17 at 0:29
These are in Homebrew for Mac as well:
geoipupdate; geoiplookup ...
– Pysis
Nov 25 '18 at 17:06
These are in Homebrew for Mac as well:
geoipupdate; geoiplookup ...
– Pysis
Nov 25 '18 at 17:06
|
show 1 more comment
This trick is even nicer and doesn't require any external packages:
curl ipinfo.io/23.66.166.151
2
In case ipinfo.io gets offline someday, ifconfig.me provides a similar service (plus a REST-like API). But ifonfo.io seems much faster.
– cedbeu
Mar 5 '15 at 15:48
1
$ host yourdomain.com | cut -d ' ' -f 4 | curl ipinfo.io/$1
– zmonteca
Mar 22 '16 at 15:57
2
ipinfo.io is free for 1000 requests/day (see their pricing documentation).
– Matthieu
Nov 14 '16 at 15:03
4
Another alternative:curl ipinfo.io/$(dig +short yourdomain.com)
– John Red
Dec 7 '16 at 17:00
2
If someone ever hits the ceiling on the ipinfo.io API (lucky you?), there is also freegeoip.net which has a mind-blowing 15,000 requests per hour limit. (Which under the hood seems to be running the geoiplookup from the other answers)
– samthecodingman
Mar 9 '17 at 13:52
|
show 4 more comments
This trick is even nicer and doesn't require any external packages:
curl ipinfo.io/23.66.166.151
2
In case ipinfo.io gets offline someday, ifconfig.me provides a similar service (plus a REST-like API). But ifonfo.io seems much faster.
– cedbeu
Mar 5 '15 at 15:48
1
$ host yourdomain.com | cut -d ' ' -f 4 | curl ipinfo.io/$1
– zmonteca
Mar 22 '16 at 15:57
2
ipinfo.io is free for 1000 requests/day (see their pricing documentation).
– Matthieu
Nov 14 '16 at 15:03
4
Another alternative:curl ipinfo.io/$(dig +short yourdomain.com)
– John Red
Dec 7 '16 at 17:00
2
If someone ever hits the ceiling on the ipinfo.io API (lucky you?), there is also freegeoip.net which has a mind-blowing 15,000 requests per hour limit. (Which under the hood seems to be running the geoiplookup from the other answers)
– samthecodingman
Mar 9 '17 at 13:52
|
show 4 more comments
This trick is even nicer and doesn't require any external packages:
curl ipinfo.io/23.66.166.151
This trick is even nicer and doesn't require any external packages:
curl ipinfo.io/23.66.166.151
edited Jul 1 '14 at 23:41
drs
3,35862961
3,35862961
answered Jul 1 '14 at 23:01
zmontecazmonteca
681153
681153
2
In case ipinfo.io gets offline someday, ifconfig.me provides a similar service (plus a REST-like API). But ifonfo.io seems much faster.
– cedbeu
Mar 5 '15 at 15:48
1
$ host yourdomain.com | cut -d ' ' -f 4 | curl ipinfo.io/$1
– zmonteca
Mar 22 '16 at 15:57
2
ipinfo.io is free for 1000 requests/day (see their pricing documentation).
– Matthieu
Nov 14 '16 at 15:03
4
Another alternative:curl ipinfo.io/$(dig +short yourdomain.com)
– John Red
Dec 7 '16 at 17:00
2
If someone ever hits the ceiling on the ipinfo.io API (lucky you?), there is also freegeoip.net which has a mind-blowing 15,000 requests per hour limit. (Which under the hood seems to be running the geoiplookup from the other answers)
– samthecodingman
Mar 9 '17 at 13:52
|
show 4 more comments
2
In case ipinfo.io gets offline someday, ifconfig.me provides a similar service (plus a REST-like API). But ifonfo.io seems much faster.
– cedbeu
Mar 5 '15 at 15:48
1
$ host yourdomain.com | cut -d ' ' -f 4 | curl ipinfo.io/$1
– zmonteca
Mar 22 '16 at 15:57
2
ipinfo.io is free for 1000 requests/day (see their pricing documentation).
– Matthieu
Nov 14 '16 at 15:03
4
Another alternative:curl ipinfo.io/$(dig +short yourdomain.com)
– John Red
Dec 7 '16 at 17:00
2
If someone ever hits the ceiling on the ipinfo.io API (lucky you?), there is also freegeoip.net which has a mind-blowing 15,000 requests per hour limit. (Which under the hood seems to be running the geoiplookup from the other answers)
– samthecodingman
Mar 9 '17 at 13:52
2
2
In case ipinfo.io gets offline someday, ifconfig.me provides a similar service (plus a REST-like API). But ifonfo.io seems much faster.
– cedbeu
Mar 5 '15 at 15:48
In case ipinfo.io gets offline someday, ifconfig.me provides a similar service (plus a REST-like API). But ifonfo.io seems much faster.
– cedbeu
Mar 5 '15 at 15:48
1
1
$ host yourdomain.com | cut -d ' ' -f 4 | curl ipinfo.io/$1
– zmonteca
Mar 22 '16 at 15:57
$ host yourdomain.com | cut -d ' ' -f 4 | curl ipinfo.io/$1
– zmonteca
Mar 22 '16 at 15:57
2
2
ipinfo.io is free for 1000 requests/day (see their pricing documentation).
– Matthieu
Nov 14 '16 at 15:03
ipinfo.io is free for 1000 requests/day (see their pricing documentation).
– Matthieu
Nov 14 '16 at 15:03
4
4
Another alternative:
curl ipinfo.io/$(dig +short yourdomain.com)
– John Red
Dec 7 '16 at 17:00
Another alternative:
curl ipinfo.io/$(dig +short yourdomain.com)
– John Red
Dec 7 '16 at 17:00
2
2
If someone ever hits the ceiling on the ipinfo.io API (lucky you?), there is also freegeoip.net which has a mind-blowing 15,000 requests per hour limit. (Which under the hood seems to be running the geoiplookup from the other answers)
– samthecodingman
Mar 9 '17 at 13:52
If someone ever hits the ceiling on the ipinfo.io API (lucky you?), there is also freegeoip.net which has a mind-blowing 15,000 requests per hour limit. (Which under the hood seems to be running the geoiplookup from the other answers)
– samthecodingman
Mar 9 '17 at 13:52
|
show 4 more comments
Here's another great option. Instructions here: http://kbeezie.com/geoiplookup-command-line/
For example, on Centos:
$ sudo yum install GeoIP GeoIP-data
$ geoiplookup 8.8.4.4
Works perfectly.
And of course, you can always set this up as a cron:
$ /usr/bin/geoipupdate
geoipupdate
is a MaxMind tool, you need a subscription and the licence key on/etc/GeoIP.conf
. I couldn't use the free alternative (Received an unexpected HTTP status code of 401).
– Pablo Bianchi
Mar 9 '18 at 22:47
add a comment |
Here's another great option. Instructions here: http://kbeezie.com/geoiplookup-command-line/
For example, on Centos:
$ sudo yum install GeoIP GeoIP-data
$ geoiplookup 8.8.4.4
Works perfectly.
And of course, you can always set this up as a cron:
$ /usr/bin/geoipupdate
geoipupdate
is a MaxMind tool, you need a subscription and the licence key on/etc/GeoIP.conf
. I couldn't use the free alternative (Received an unexpected HTTP status code of 401).
– Pablo Bianchi
Mar 9 '18 at 22:47
add a comment |
Here's another great option. Instructions here: http://kbeezie.com/geoiplookup-command-line/
For example, on Centos:
$ sudo yum install GeoIP GeoIP-data
$ geoiplookup 8.8.4.4
Works perfectly.
And of course, you can always set this up as a cron:
$ /usr/bin/geoipupdate
Here's another great option. Instructions here: http://kbeezie.com/geoiplookup-command-line/
For example, on Centos:
$ sudo yum install GeoIP GeoIP-data
$ geoiplookup 8.8.4.4
Works perfectly.
And of course, you can always set this up as a cron:
$ /usr/bin/geoipupdate
edited Sep 30 '15 at 2:59
slm♦
261k72564711
261k72564711
answered Apr 25 '15 at 6:01
zingerzinger
8112
8112
geoipupdate
is a MaxMind tool, you need a subscription and the licence key on/etc/GeoIP.conf
. I couldn't use the free alternative (Received an unexpected HTTP status code of 401).
– Pablo Bianchi
Mar 9 '18 at 22:47
add a comment |
geoipupdate
is a MaxMind tool, you need a subscription and the licence key on/etc/GeoIP.conf
. I couldn't use the free alternative (Received an unexpected HTTP status code of 401).
– Pablo Bianchi
Mar 9 '18 at 22:47
geoipupdate
is a MaxMind tool, you need a subscription and the licence key on /etc/GeoIP.conf
. I couldn't use the free alternative (Received an unexpected HTTP status code of 401).– Pablo Bianchi
Mar 9 '18 at 22:47
geoipupdate
is a MaxMind tool, you need a subscription and the licence key on /etc/GeoIP.conf
. I couldn't use the free alternative (Received an unexpected HTTP status code of 401).– Pablo Bianchi
Mar 9 '18 at 22:47
add a comment |
Or use whois
$ whois 8.8.8.8 |grep country -i -m 1 |cut -d ':' -f 2 |xargs
US
New contributor
add a comment |
Or use whois
$ whois 8.8.8.8 |grep country -i -m 1 |cut -d ':' -f 2 |xargs
US
New contributor
add a comment |
Or use whois
$ whois 8.8.8.8 |grep country -i -m 1 |cut -d ':' -f 2 |xargs
US
New contributor
Or use whois
$ whois 8.8.8.8 |grep country -i -m 1 |cut -d ':' -f 2 |xargs
US
New contributor
New contributor
answered 2 hours ago
DanielDaniel
1
1
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f7399%2fip-to-country-console-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown