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

查看:105
本文介绍了如何终止在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 javagrep 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屋!

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