Possible Duplicate:
Finding the process that is using a certain port in Linux
I'm using Ubuntu Linux 11.04. How do I write a shell script expression that will find the process running on port 4444 and then kill the process?
I'm using Ubuntu Linux 11.04. How do I write a shell script expression that will find the process running on port 4444 and then kill the process? | ||||
|
feedback
|
This question came from our site for professional and enthusiast programmers.
This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ for guidance on how to improve it.
|
You could use
would list only the pid of the process listening on port 4444. You could just say
if you were brave. | |||||
feedback
|
|
You use
The output will be something like:
Where the first column is the process name, and the second column is the process id. You then parse the output, find out what the process id (PID) is and use | |||
feedback
|
|
Alternatively you could use | |||
|
feedback
|
Uses netstat to list listening INET sockets with numeric ports and parent processes. Filters for string 4444, takes out the 7th column( pid/process name ) and further splits it by "/" to get the pid. Passes that to kill command. | |||
feedback
|