The Most Active and Friendliest
Affiliate Marketing Community Online!

“Adavice”/  “1Win

geoip lookup in a terminal or ssh

Graybeard

Well-Known Member
This is only tested in Ubuntu should work on Debian also? May work in Centos

#1 install
barry@paragon-DS-7:~$ sudo apt install geoip-bin
[sudo] password for barry:
then !
=====standard output;
barry@DS10:~/temporary$ geoiplookup 2.40.118.141
GeoIP Country Edition: IT, Italy
=============scripted output

Code:
$  ip=2.40.118.141; echo -n 'id,'$ip','; geoiplookup $ip |cut -d':' -f2|cut -d',' -f1|sed 's/^[ \t]*//;s/[ \t]*$//'
id,2.40.118.141,IT


Super fast.
Could be easily scripted in a loop.
Use I intend -- checking server log entries FAST
Downside: only country names

IP to Country console command
details :)
 
Last edited:
MI
Back