check what is running on port linux

C++
sudo lsof -i:22sudo lsof -i:<port_number>active port
Source

Also in C++: