Geo – A Simple BASH Utility To Get Network And Geolocation Details
A while ago, we wrote a blog post about “Bash-Snippets”, a set of BASH scripts for heavy command-line users. Those scripts consists of many useful utilities such as crypt, geo, cheat, weather, ytview and more. Using bash-Snippets, you can install all utilities or a particular one. In this brief guide, we are going to discuss about only one utility in the Bash-Snippets called “Geo”. It is used to display wan, lan, router, dns, mac address, and geolocation output, with clean stdout for piping.
$ yay -S geo-bash
In the other distributions, you can install Geo either using “Bash-Snippets” as described in the installation section. Or, directly download it from here and manually compile and install it. Please note that the Geo utility we are talking about here is same as in the Bash-Snippets. If you have already installed it from bash-Snippets, just skip the installation part and go to the Geo Usage section.
Let us now see the usage of Geo utility.
To display your local IP address, run:
$ geo -l 192.168.43.192
To view the wan IP, use -w flag.
$ geo -w 18.104.22.168
To check the DNS:
$ geo -d 192.168.43.1
Check Mac address of your network interface card:
$ geo -m enp5s0 28:c6:gd:57:6b:32
Here, enp5s0 is my Ethernet card.
Also, you can combine all flags in one command like below. The following command will display your LAN, WAN ip, DNS, and Mac id.
$ geo -lwdm enp5s0 22.214.171.124 192.168.43.192 192.168.43.1 28:c6:gd:57:6b:32
To display the gelocation, run:
$ geo -g India TN Chennai Vodafone India 126.96.36.199
To view the help section, just type “geo”:
$ geo Geo Description: Provides quick access for wan, lan, router, dns, mac, and ip geolocation data Usage: geo [flag] -w Returns WAN IP -l Returns LAN IP(s) -r Returns Router IP -d Returns DNS Nameserver -m Returns MAC address for interface. Ex. eth0 -g Returns Current IP Geodata Examples: geo -g geo -wlrdgm eth0 Custom Geo Output => [all] [query] [city] [region] [country] [zip] [isp] Example: geo -a 188.8.131.52 -o city,zip,isp -o [options] Returns Specific Geodata -a [address] For specific ip in -s -v Returns Version -h Returns Help Screen -u Updates Bash-Snippets
Hope this helps. More good stuffs to come. Stay tuned!
Thanks for stopping by!
Help us to help you:
- Subscribe to our Email Newsletter : Sign Up Now
- Support OSTechNix : Donate Via PayPal
- Download free E-Books and Videos : OSTechNix on TradePub
- Connect with us: Facebook | Twitter | Google Plus | LinkedIn | RSS feeds
Have a Good day!!