see what is using a port ubuntu

C++
sudo ufw allow 1191/tcp$ sudo lsof -i:22
Source

Also in C++: