DEV Community

Cover image for Basic Networking Commands in Linux
Seb
Seb

Posted on

Basic Networking Commands in Linux

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 -

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

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

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

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

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

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

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

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

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

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

Top comments (0)