Determine the process pid listening on a certain port

前端 未结 8 1724
孤城傲影
孤城傲影 2021-01-29 23:30

As the title says, I\'m running multiple game servers, and every of them has the same name but different PID and the port number. I would

8条回答
  •  一向
    一向 (楼主)
    2021-01-30 00:05

    Since sockstat wasn't natively installed on my machine I hacked up stanwise's answer to use netstat instead..

    netstat -nlp | grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:2000" | awk '{print $7}' | sed -e "s/\/.*//g""
    

提交回复
热议问题