how to get process id in linux

C++
ps uxlsof -i tcp:3000
kill -9 pId
Source

Also in C++: