Below we will see some useful commands networking that are pre-installed on your computer and will help you to know everything about a website.
What is my IP address? Who is the host of a website? Which mail service uses this domain? There are tools on the web that can reveal these details, but this can be done using the command line on your computer (Linux-Mac).
What is my IP address?
Make a request with curl or wget at checkip.amazonaws.com and you will see the public IP address of your computer. You can also open Akamai's whatismyip.akamai.com and you will see your external IP address.
What is my private IP address?
ifconfig en0 | grep inet
Your computer has a private IP address that only works on the local network.
Find the location of the IP address
The free ip2c service can display the country of an IP address.
Alternatively, use the ipapi service to get more details of an IP address (City name, time zone, and even latitude - longitude associated with an IP address.
Check DNS records
The dig command will help you request any type of DNS records for a domain from the command line.
1. Find the IP address of a website
dig + short iguru.gr
2. Find the domain mail server
Mail exchange (MX) records show incoming message servers used to deliver email messages sent from a domain.
host -t MX iguru.gr
3. Display all DNS records of a domain
See a list of all the DNS records of a domain, along with the TXT, MX, and other records.
dig + nocmd amazon.com any + noall + answer
Who hosts a page?
Use the dig command to find the IP address of a site, and then use the same dig command to perform a reverse lookup to find the host of that IP address.
For example, this command will display the Netflix IP address:
dig + short netflix.com A | tail -1
Use the IP address in the following command to see the hostname:
dig + nocmd -x 18.104.22.168 + noall + answer
Find the site owner
Use the whois command to reveal important information about any domain. You will see the date on which it was first registered, the contact details of the website owner, the expiration date of the domain, the name of the registrar and more.
You can also query the details of registering a domain on the server of a particular registrar with the flag -h. For example, the following command does a whois lookup on a site using the Google Domains WHOIS server.
whois -h whois.google.com domain.com
Ping network connectivity test
The ping command helps you control if a remote server is accessible and if your machine can connect properly to it.
ping -c 5 -i 2 iguru.gr
The above command pings the server 5 times with a wait of 2 seconds between pings.
Where is the mistake?
If your Internet connection is working but you cannot open a website, there may be a problem with a proxy that does not allow packets to pass through to reach the server.
The traceroute commands will show you the path from your local computer to the site through which the traffic should pass. This information can be useful in diagnosing connectivity issues.