如何终止在Linux中特定端口上运行的进程? [英] How to kill a process running on particular port in Linux?
问题描述
我试图使用tomcat /bin
目录中的./shutdown.sh
关闭tomcat.但是发现服务器没有正确关闭.因此,我无法重新启动
我的tomcat在端口8080
上运行.
I tried to close the tomcat using ./shutdown.sh
from tomcat /bin
directory. But found that the server was not closed properly. And thus I was unable to restart
My tomcat is running on port 8080
.
我想杀死在8080
上运行的tomcat进程.我首先要具有在特定端口(8080)上运行的进程的列表,以便选择要杀死的进程.
I want to kill the tomcat process running on 8080
. I first want to have the list of processes running on a specific port (8080) in order to select which process to kill.
推荐答案
使用命令
sudo netstat -plten |grep java
用作grep java
的grep java
使用java
作为其处理.
used grep java
as tomcat
uses java
as their processes.
它将显示带有端口号和进程ID的进程列表
It will show the list of processes with port number and process id
tcp6 0 0 :::8080 :::* LISTEN
1000 30070621 16085/java
/java
之前的数字是进程ID.现在使用kill
命令杀死该进程
the number before /java
is a process id. Now use kill
command to kill the process
kill -9 16085
-9
表示该过程将被强制终止.
-9
implies the process will be killed forcefully.
这篇关于如何终止在Linux中特定端口上运行的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!