且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何杀死在 Linux 中的特定端口上运行的进程?

更新时间:2023-01-17 21:59:09

使用命令

 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.