Linux – Network comands

This article provides a summary of the most important or frequently used commands.

Please keep in mind that these tips assume you already have a configured Linux hostname and IP, with a working network card and connection.


This short but quite useful command allows you to check your network card for connectivity and review your IP address and host network information. Although I tend to use other commands more frequently, arp is useful when I want to very quickly check status on my network card.


The host command is something I use very regularly to check either the hostname of a specific server when I have the IP address, or the IP address when I have a specific hostname. The primary function of the host command is to enable a quick lookup of DNS server information. But don’t underestimate the power of this command. The host command allows you to perform many different queries using the -t option.

For instance, you can use the -t with TOC to specify that you wish to lookup a host geographical location: host -t LOC hostname (replace hostname with the fully qualified domain such as

The ifconfig command allows you to check and configure your server’s network cards, assigning IP, DNS, and Gateway addresses. For example, to assign a specific IP address for the eth0 network card, you can use:

ifconfig eth0 XXX.XXX.XXX.XXX

(replace to XXX.XXX.XXX.XXX with an actual IP address)

Moreover, using the plain ifconfig command shows you the details of all the existing configured network cards and network interfaces. You can get more information about it in the administrative command list. Using ifconfig is a very good way to check that your network hardware is working properly.


The netstat command offers you a simple way to review each of your network connections and open sockets. I frequently use the netstat with the head command to review the top few lines of output, which are helpful when performing web server administration. For example:

netstat | head

Also, by including the -r option, you get a very good summary of all of the network routing addresses.


No basic network administration is effective without the ping command. I use it for testing server configuration and checking status. The ping command basically sends test packets to a specific server and checks if there is a response. The command is very helpful when trying to determine where a connectivity error originates.


(replace the XXX.XXX.XXX.XXX with the specific IP address of the server you wish to check)

When you run the command, please remember to press Ctrl and C to stop the process. More details are available in our administrative command list.

Ping is a useful command and should be one of your first tests when a network failure occurs. If it works but for instance HTTP connections don’t, then you know that the server network connectivity is correct, so the fault may instead be with the HTTP daemon or a problem with firewall settings. You can get more information about it in the administrative command list. More importantly, if even the ping command fails to work, you know that there is a more significant server connectivity issue. It is a very fast way to check servers, even remotely.


This command allows you to check the Internic database for proper hostnames. This is very handy when you are trying to trace back an IP address to a specific hostname, or the reverse. I often use it when troubleshooting connectivity between hosts and checking whether the problem is a host configuration error or an actual physical connectivity error. The most commonly used version of the command is:

whois -f XXX.XXX.XXX.XXX

(replace the XXX.XXX.XXX.XXX with a specific server IP)

The -f option forces the command to skip any cache that may have stored the host state, and instead goes to the actual server to perform a lookup and verify its hostname.

Another useful variation of the command, especially for trying to identify port problems is:

whois –port=1122 XXX.XXX.XXX.XXX

This command forces a test on the specific host’s port 1122. You can benefit from force checking specific ports in many ways, and I highly recommend testing ports with this technique.

Leave a Reply

Your email address will not be published. Required fields are marked *