To know the process id which is running on a specific port number
$ sudo netstat -nlp | grep :1212
tcp6 0 0 :::1212 :::* LISTEN 21341/java
$ lsof -i
It displays the information of all currently running process like PID, port number, user etc.
Example:-
$ lsof -i
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 60729 ram 7188u IPv6 121212 0t0 TCP *:1291 (LISTEN)
java 60850 ram 7181u IPv6 1212 0t0 TCP *:1195 (LISTEN)
java 60949 ram 8173u IPv6 1212 0t0 TCP *:2272 (LISTEN)
java 70040 ram 1971u IPv6 1213 0t0 TCP *:2230 (LISTEN)
java 70142 ram 9072u IPv6 11111 0t0 TCP *:4449 (LISTEN)
java 70232 ram 1365u IPv6 111 0t0 TCP *:5585 (LISTEN)
java 70318 ram 1476u IPv6 111 0t0 TCP *:6514 (LISTEN)
python 70400 ram 43u IPv4 2222 0t0 TCP *:1232 (LISTEN)
java 180595 ram 3402u IPv6 22222 0t0 TCP *:3232 (LISTEN)
Then run kill command to kill it.
$kill -9 <PID>
Thanks you.
No comments:
Post a Comment