DEV Community


Posted on

What ports are I serving?

Sometimes we need to know what ports are our server/pc serving.

Few years ago netstat was the command that have us a clue about the ports a machine was listening to. I usually launch

$ netstat -putona

And we got the ports our machine is listening to.

But nowadays Linux servers don't install the net-tools package and we have to use another tools. This case suggest us using ss command. ss is a tool that allow us knowing what ports are listening in our system. ss is netstat replacement and we can do many operations with this command:

ss -a

This command list all ports our system has opened

ss -l

Only returns listening ports

ss -p

Returns the PID of the process running a networking activity.

I use ss -lt | grep "*:" to get current listening ports and check what is happening in my network.

Discussion (0)