Basic Networking Commands in Linux
Tags: linux
Published: 2021-08-15 17:10:48

Hi everyone! Welcome to my first article on DEV :) 

Today I will be doing a better overview of some basic networking commands in Linux. 

I recently created a short and sweet thread on twitter with these commands, so right now, I will be going over them a bit more with more detail and information.

If you want to check out the twitter thread, go here - {% twitter 1426721727485153285 %}


## ping


The 'ping' command stands for Packet Internet Groper. It is used to test the network connections between two computers and to see if a host is reachable. 

So how does it work? Well, the 'ping' command uses something called ICMP, which stands for Internet Control Message Protocol. It sends an ICMP echo request message to the IP address you request. If the connection is successful, it responds with an ICMP echo reply message. You will know the host is reachable if you get the ICMP echo reply message

![ping](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fpi9hrht397ulnpk05ec.png)
 


## dig
 The 'dig' command can be used to view information about the Domain Name Servers of a website. It stands for "Domain Information Groper". Besides name servers, you can also view information about host addresses and mail exchanges. While anyone can use this command, it's mostly used by System Administrators.

![dig](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mnel5pt3un8yy6d4skbz.png)
 


## whois


The 'whois' command is another basic command that is used to look up information. In this case, using whois will give you details about a domain, such as owner information. 

Check out the screenshot to see what it shows you:

![whois](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sjnq3aicfs7qcla0913a.png)
 



##  hostname

This command is as it says. If for any reason you need to use it, it just tells you what the hostname is.

![hostname](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cduu9lj8nztg01ij689o.png)
 


## ip a

The 'ip a' command is among a couple you can use to find your IP address. Of course, knowing what your IP address is, is important. 

You can also use the IP command to view certain things. Such as 'ip link', this command will display link layer information. 

![ip a](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b7w3ssp7qf9rtvz3i074.png)
 


## finger

The 'finger' command shows you the details of all users who are logged in. This is a great command for sysadmins as well as they can see things such as exact login times and even emails of users. In order to use this command, you may need to install it. To do so, run 'sudo apt-get install finger'


![finger](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v4vphgxhn0h53aagfwva.png)
 

## netstat -a

Another useful command is 'netstat'. In this case, I am using 'netstat -a' to list all the ports that are listening. 

A listening port is when your machine is ready to accept a connection on that port. You can close and open ports at anytime. 

![netstat](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7vc94xb6ei91z7uxi3xv.png)


## traceroute

The 'traceroute' command displays the route a packet took to reach the host. If you look at my screenshot below, you can see how many 'hops' it took for me to reach the requested host. A hop happens when a packet is passed from one network segment to the next network segment



![8](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sdwr42d61w3b7gajaaaq.png)






## WOW, thank you for reading all the way to the end.

I do plan on posting more about Linux in the future. Stay tuned!