← Lessons

quiz vs the machine

Gold1350

Networking

The Netstat and SS

Listing sockets and connections on a host.

5 min read · core · beat Gold to climb

Looking At Local Sockets

Sometimes the problem is on your own machine. The netstat and the newer ss tools list the network sockets a host has open, so you can see what is listening and what is connected.

What They Show

Each row describes one socket and its state.

  • A listening socket waits for inbound connections on a port.
  • An established socket is an active connection with a remote address.
  • States like TIME WAIT show connections that recently closed and are lingering.

The ss tool is faster than netstat on busy hosts because it reads kernel socket data more directly.

Common Uses

You can confirm a service is actually listening on the port you expect, find which process owns a socket, or count how many connections a server holds. A flood of sockets stuck in TIME WAIT can point to a client that opens and closes connections too aggressively rather than reusing them.

Key idea

Netstat and ss list a host local sockets and their states, letting you confirm a service is listening, see established connections, and spot a pile of TIME WAIT sockets that hints at connection churn.

Check yourself

Answer to earn rating on the learn ladder.

1. What does a listening socket represent?

2. What can many sockets stuck in TIME WAIT suggest?

3. Why is ss often preferred over netstat on busy hosts?