我尝试在tomcat /bin目录下使用。/shutdown.sh关闭tomcat。但发现服务器没有正确关闭。因此我无法重新启动我的tomcat运行在端口8080上。
我想终止在8080上运行的tomcat进程。我首先想要在特定端口(8080)上运行的进程列表,以便选择要终止哪个进程。
我尝试在tomcat /bin目录下使用。/shutdown.sh关闭tomcat。但发现服务器没有正确关闭。因此我无法重新启动我的tomcat运行在端口8080上。
我想终止在8080上运行的tomcat进程。我首先想要在特定端口(8080)上运行的进程列表,以便选择要终止哪个进程。
当前回答
sudo apt-get install psmisc (or sudo yum install psmisc)
sudo fuser 80/tcp
结果: 80/tcp: 1858 1867 1868 1869 1871
逐个杀死进程
杀死-9 1858
其他回答
首先检查进程netstat -lt 检查进程id fuser <端口号>/tcp Kill <进程id>
使用命令
sudo netstat -plten |grep java
使用grep Java作为tomcat使用Java作为他们的进程。
它将显示带有端口号和进程id的进程列表
tcp6 0 0 :::8080 :::* LISTEN
1000 30070621 16085/java
“/java”前面的数字是进程号。现在使用kill命令终止进程
kill -9 16085
-9表示进程将被强制终止。
选项1在特定端口上只杀死LISTEN的一行程序:
kill -9 $(lsof -t -i:3000 -sTCP:LISTEN)
选项2如果你安装了npm,你也可以运行
npx kill-port 3000
这将杀死端口80上运行的程序
sudo fuser -k 80/tcp
kill -9 ' fuser 8080/tcp|xargs -n 1 ',该命令同时关闭监听8080端口的tcp连接进程