Whether troubleshooting connectivity issues, analyzing network traffic, verifying DNS resolution, or checking listening services, Linux provides a powerful set of built-in networking tools for day-to-day administration and debugging.

In this cheat sheet, we will look at some of the most essential Linux network commands commonly used for diagnostics, monitoring, and troubleshooting in enterprise and lab environments.

I will update this post on a regular basis.



Checking Listening Ports and Active Network Connections

The ss command is a modern and powerful replacement for legacy tools like netstat on Linux systems.

It can be used to quickly inspect listening TCP/UDP ports, active network connections, associated processes, and socket statistics, which is especially useful for troubleshooting network services such as SMTP, web servers, or SSH daemons.

For checking if Postfix is listening on TCP 25 e.g, the most useful ss command is:

# ss -tlnp | grep :25


Flags:

  • -t → TCP sockets
  • -l → listening sockets only
  • -n → numeric ports/IPs
  • -p → show process using the socket

The following ss commands can be used to verify whether a DNS service is actively listening on UDP port 53 and to identify the associated process handling incoming DNS requests.

# ss -ulnp | grep :53


Flags:

  • -u → UDP sockets
  • -l → listening sockets
  • -n → numeric output
  • -p → show associated process

Links

ss — Linux manual page
https://man7.org/linux/man-pages/man8/ss.8.html