List process by port number netstat -ano | findstr 8080 Proto Local Address Foreign Address State PID TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 29848 -a – Displays all connections and listening ports. -o – Displays the owning process ID associated with ea
前言 现在项目组基本都用Springboot,每个服务占用一个端口号,有时需要选择性的关闭,但在任务管理器上他们的名称都是java.exe,无法区分,这才学以致用. killPort.sh 作用:根据端口号查询PID(process id),再根据PID杀死进程 #!/bin/bash if [[ "$1" = "" ]] then echo "port num must not be null" exit 2 fi pidInfo=`netst