5 basic network commands for Linux and Windows

Administrators today work across more diverse platforms than ever before. From Windows workstations to Linux servers to macOS laptops, they encounter a dizzying array of environments. Cloud computing and containers take this complexity to another level. It’s difficult enough for administrators to get all the shell commands for their platform of choice, let alone those needed for another operating system. Add cloud services and the task becomes even more difficult.

This article provides a list of common commands for managing network services, organized by task rather than platform. It first identifies the task and then shows the standard Linux and Windows commands for managing the service or utility. The goal is to provide a cross-platform reference that will help all administrators.

First, I show commands that identify the system, followed by Dynamic Host Configuration Protocol (DHCP) lease management commands. Next, I view network connections and test name resolution. Finally, I cover the commands for testing network connectivity. Administrators can use these commands on their physical and virtual networks to verify proper configuration and troubleshoot connectivity issues.

1. Identify the system

One of the most basic commands for identifying the local system is the hostname Command. This command works on both Linux and Windows systems. It might not be exciting, but it’s at least consistent.

Another common task is to view the system’s IP address. Linux has changed in recent years, away from the ifconfig command to the IP command – to be more precise IP address. At the traditional Windows command prompt ipconfig displays the system’s basic IP address information, although administrators can use that as well Get-NetIPAddress Cmdlet in a PowerShell window.

Linux commands:

ip addr

Legacy Linux command:


Windows commands:


2. Manage DHCP clients

Administrators often need more information about how a system obtained an IP address configuration. Most workstations lease an IP address from a DHCP server. Sometimes it is necessary to get a new configuration. Linux admins typically achieve this with the dhclient command while using their Windows counterparts ipconfig with the /share and /renew Switch.

Linux commands:

Release the current configuration

dhclient -r

Purchase a new lease


Windows commands:

Release the current configuration

ipconfig /release

Purchase a new lease

ipconfig /renew

3. View current network connections

Both platforms recognize the net stat Command to display current connections to the system. Many Linux administrators prefer to use ss command, but that’s a personal preference. There are many options to limit the output to the information administrators need. To view these options on Linux, use –Help or the manual page. On Windows, try the /? switch.

Linux and Windows command:


Linux command:


4. Test the name resolution

Name resolution is one of the most critical services in the network. Name resolution correlates easy-to-remember hostnames with hard-to-remember IP addresses. The DNS service hosts a dynamic database of resource records that track names and IP addresses.

Regardless of which platform administrators prefer, they should recognize that all network nodes have common configuration requirements and troubleshooting requirements.

If clients cannot reach DNS servers, they may not be able to check email, access data stored on remote file servers, print, or reach required web pages. Troubleshooting name resolution is a common task.

Interestingly, Linux and Windows systems share one of the most important utilities: nslookup. Originally a Linux tool, nslookup is included with Windows. It allows administrators to create manual DNS queries as part of troubleshooting. Linux also relies on two other commands, dig and hostto troubleshoot DNS issues. Windows administrators can use it Resolve DnsName PowerShell cmdlet to achieve the same.

Linux commands:

nslookup {remote-system}
dig {remote-system}
host {remote-system}

Windows commands:

nslookup {remote-system}
Resolve-DnsName -Name {remote-system}

5. Test network connectivity

Another common task is testing connectivity and verifying the path traffic is taking across the network. The traditional tool for this is Ring. Both Linux and Windows recognize them Ring command, although Linux sends continuous pings by default, while Windows only sends four unless otherwise specified.

Both platforms also share the trace route Utility, although Windows spells out the command tracert. This tool shows the routers, or hops, that packets go through as they traverse the network. With this information, administrators can see where packets are going and identify potential network performance issues, congestion, or outages. PowerShell can do the same by using the Test-NetConnection -ComputerName server01 -TraceRoute cmdlet.

Linux commands:

ping {destination}
traceroute {destination}

Windows commands:

ping {destination}
tracert {destination}
Test-NetConnection -Computername {destination} -TraceRoute

Wrap up

Regardless of which platform administrators prefer, they should recognize that all network nodes have common configuration requirements and troubleshooting requirements. Windows networking has its roots in old Unix implementations of TCP/IP, and so many commands are common, or at least similar. In fact, macOS also shares many of the Linux commands listed above.

Whether admins connect to a remote Linux server in the cloud from their Windows admin workstation or use Secure Socket Shell from their Linux laptop to access a local Windows server, they’ll find it that many commands for collecting network information are similar. Administrators can learn these commands to increase their variety and flexibility as an administrator.

About Willie Ash

Check Also

Thunderbird 102 includes an improved import tool

The team that develops the Thunderbird email client has been working on the next major …