3 回答
TA贡献1877条经验 获得超1个赞
goto命令提示符
netstat -aon
对于Linux
netstat -tulpn | grep 'your_port_number'
它会向您显示类似
TCP 192.1.200.48:2053 24.43.246.60:443 ESTABLISHED 248
TCP 192.1.200.48:2055 24.43.246.60:443 ESTABLISHED 248
TCP 192.1.200.48:2126 213.146.189.201:12350 ESTABLISHED 1308
TCP 192.1.200.48:3918 192.1.200.2:8073 ESTABLISHED 1504
TCP 192.1.200.48:3975 192.1.200.11:49892 TIME_WAIT 0
TCP 192.1.200.48:3976 192.1.200.11:49892 TIME_WAIT 0
TCP 192.1.200.48:4039 209.85.153.100:80 ESTABLISHED 248
TCP 192.1.200.48:8080 209.85.153.100:80 ESTABLISHED 248
检查哪个进程绑定了您的端口。在上面的示例中,248如果您确定需要杀死该进程火,则为现在
Linux:
kill -9 248
视窗:
taskkill /f /pid 248
它会杀死那个过程
TA贡献1871条经验 获得超8个赞
如果在Linux上,您可以使用此脚本杀死现有的Tomcat。
#/bin/bash
if [ `whoami` != root ]; then
echo "Please run this script as root or using sudo"
exit
fi
echo
echo "finding proceses that have name java and established connections status"
echo
echo "Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name"
netstat --tcp --programs | grep "ESTABLISHED" | grep "java"
echo
echo "finding proceses that use port 8080 or http-alt"
echo
netstat --tcp --programs | grep ':8080\|:http-alt'
echo -n "Do you wish to kill a process listed above?[Y/n]"
read choose
if [ "$choose" = "Y" ] || [ "$choose" = "y" ] || [ -z "$choose" ]
then
echo "enter pid to kill"
read procesId
kill -9 $procesId
fi
echo "done exiting"
exit 0
添加回答
举报