all the ports on a computer code example
Example 1: see what ports are in use
Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess
Example 2: how to check listening ports on a server
sudo ss -tulwn | grep LISTEN
Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess
sudo ss -tulwn | grep LISTEN