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". Geo is used to display wan, lan, router, dns, mac address, and geolocation output, with clean stdout for piping.
Install Geo In Linux
$ yay -S geo-bash
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 below.
Get Network And Geolocation Details Using Geo
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 220.127.116.11
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 18.104.22.168 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 22.214.171.124
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 126.96.36.199 -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.