Tuesday, 14 November 2017

linux - How to close or (unbind?) a port left open by a rogue application?


I am using Fedora 13 64bit. My eclipse program starts a server on port 9050 but I shutdown the program, eclipse fails to properly shutdown the server. Restarting eclipse has no effect.


How can I close or unbind a port forcibly from command line?


I know rebooting or log off and back on will clear the ports but this much slower process for me. I am looking for forcibly closing the port in command line.



Answer



The only way to forcefully close a listening port is to kill the process that is listening on it. Use lsof, netstat, fuser – as root – to find out the process ID. Once the process exits (by itself or by being killed), the kernel will automatically clean up all sockets it had open. (However, there might be cases that programs will be denied listening on the same port for a few minutes; in this case all you can do is wait.)


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...