Pages

Wednesday, July 3, 2019

How to find and kill the program that's using a specific port number Windows and Linux

Windows:

1. Find the program that is using a port number:

D:\>netstat -ano | findstr 8090
  TCP    0.0.0.0:8090           0.0.0.0:0              LISTENING       10716
  TCP    [::]:8090              [::]:0                 LISTENING       10716

2. Kill the program:

D:\>taskkill /F /pid 10716
SUCCESS: The process with PID 10716 has been terminated.

Linux:

1. Find the program that is using a port number:

[koacervate@SVT00005523 ~]$ sudo netstat -lnp | grep 6379
tcp        0      0 10.16.30.76:6379        0.0.0.0:*               LISTEN      24982/redis-server
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      24982/redis-server

2. Kill the program:

[koacervate@SVT00005523 ~]$ ps -aef | grep redis
root     24982     1  0 13:31 ?        00:00:00 /usr/local/bin/redis-server 127.0.0.1:6379
htct     25086 24560  0 13:31 pts/0    00:00:00 grep --color=auto redis
[koacervate@SVT00005523 ~]$ sudo kill -9 24982

:))

No comments:

Post a Comment