![Man_With_Laptop Man_With_Laptop](https://cloudreboot.wordpress.com/wp-content/uploads/2022/04/man_with_laptop_thumb.jpg?w=640&h=427)
Ping command
The ping command is a command with a command-line interface (CLI) that you can find on every Linux distro and probably any OS in general (FreeBSD, Windows, macOS, ChromeOS, etc.). It sends packets of data using the Internet Control Message Protocol (ICMP) to a destination that could be defined by an IP address or a domain name. Then it will wait for the echo, the reply for each of those ICMP messages to return. In the end, you will get information about the time the packets reached the destination and if there were lost packets too.
The ping command is maybe the simplest command that you can use for network diagnostic. It is great for checking if a device is connected and running. If it is, it will reply to your ping command.
Examples of the ping command:
ping –n 15 yourdomain.com.
This one will send 15 packets to the target, which in this case is yourdomain.com.
This will show you how long it takes you to reach the IP address 123.123.123.123.
Nslookup command
Nslookup command is another universal command with a CLI interface. As the name suggests, nslookup is software to probe name servers and get different DNS records. It works for both a forward lookup and a reverse lookup too.
Examples of the Nslookup command:
nslookup -type=ns yourdomain.com
This will check for the NS record of yourdomain.com. There you can see the authoritative name servers of that domain.
After the “=” sign, we are specifying the DNS type. You can change it to A, AAAA, MX, SOA, CNAME, PTR, or another type that you are interested in.
nslookup -type=any yourdomain.com
If you want to see all publicly available DNS records for a domain, you can directly use the “any” type.
This will make a reverse lookup and see to which domain, does the IP address 123.123.123.123 belongs.
Traceroute command
Traceroute command does exactly what you are expecting – it can trace the route of the packets of data and report the finding to you. Why would you like to know the route? Knowing the route, you can see bottlenecks in the connectivity and think about solutions to improve it. Imagine your website, which has web hosting in Europe, shows that all the American visitors are experiencing a very long route that passes through a specific slow location. You can think about a CDN with servers around that location and increase the speed significantly.
The Traceroute command is a great troubleshooting Linux command that you can easily use through the Terminal. You can use it in tandem with the Ping command. With this one, you can see the whole route, but it takes longer for the response to arrive. With the Ping, you get an almost instant answer for a single IP address or a domain.
Examples of the Traceroute command:
traceroute yourdomain.com
This will show you all the hops that the packets of data take, starting from your device to the target yourdomain.com.
traceroute 123.123.123.123
This will show you all the hops that the packets of data take, starting from your device to the target 123.123.123.123. As you can see, it works both with domain names and IP addresses (both IPv4 addresses and IPv6 ones).
map command
Nmap command is a simple tool that can map your network. A network administrator can use the Nmap command and send packets to all of the available hosts on the network. By doing so, it will see who is connected, what services are running (application names and versions) on them, their OSes, check the firewalls they have, and more.
It is a big advantage that it can be used for very large networks with many connected devices. The packets that it sends can be sent over TCP or UDP. As you prefer.
What is great about it is that it is available for many different Linux distros, but also for Windows, macOS, FreeBSD, and more. In addition, it is free and open-source! This software is not pre-installed like some of the previously mentioned, so you will need to download it from the official site.
Examples of the Nmap command:
This will show all the open services and ports of the host (the server).
You can use an IP address (both IPv4 and IPv6) and see the open ports and services of the host.
nmap 123.123.123.123 111.111.111.111 222.222.222.222.
You can scan multiple hosts by simply put their IP addresses with a space in between. Here we have 3 hosts in this example.
Use the “*” simple to indicate all of the possible combinations of hosts inside the subnet.
With this Linux network command, you can see the OS (Operating system) of the host 123.123.123.123.
The option above will show you the firewall settings of the particular host.
A “stealth” mode for the Nmap command. You could use it to stay undetected. It uses TCP SYN packets.
Nmap is a very interesting command that could be very useful, no matter if you are a network administrator or you want to see information about your server.
Dig command
The dig command is probably the best software with CLI that you can use on a Linux computer. You can get all kinds of detailed information about a domain, including DNS records, name server information, connectivity from different points, and even trace the route.
Examples of the Dig command:
This will show you the NS records have the information about the name servers for the particular domain. You can change the last part of this query with the type of DNS record that you want to probe. Try one of the following:
IPv4 addresses.
IPv6 addresses.
Information about the DNS zone.
Incoming mail server.
Different TXT records.
The linked canonical hostname for the specific domain.
The Dig command, with the option “-x”, can be used to perform reverse DNS lookup by probing an IP address.
dig +trace yourdomain.com
You can use the Dig command to trace the route to the target with the option “+trace”.