如何杀死在 Linux 中的特定端口上运行的进程? [英] How to kill a process running on particular port in Linux?

查看:37
本文介绍了如何杀死在 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

used grep java as tomcat 使用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆