Command:
lsof -i

Lsof (LiSt Open Files) lists info about open files, by processes, ports currently running on the system.