查询端口被占用及终止
windows下
cmd进入命令行
$ netstat -aon | findstr "80"
若本地安装了cygwin,可以用grep 80
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 2044
TCP 0.0.0.0:8081 0.0.0.0:0 LISTENING 2756
TCP 0.0.0.0:49153 0.0.0.0:0 LISTENING 804
TCP 192.168.126.197:56557 192.168.101.12:8000 ESTABLISHED 5496
TCP 192.168.126.197:58060 125.39.205.74:443 CLOSE_WAIT 7612
然后,看下是什么任务在占用
$ tasklist | findstr '2044'
httpd.exe 2044 Services 0 6,248 K
then kill it
$ taskkill /pid 2044 /F
检验一下结果:
$ tasklist | findstr '2044'
Linux下
$ netstat -anl | grep "80" 或者可用 $ lsof -i:80
$ kill pid
or
$killall -9 name