You generally use lsof to list the files which are open in the system. However, with the option -i, lsof lists all of the processes with the sockets/ports which they are using.
lsof -i
To find the PID of the process holding up a port:
lsof -i | grep port_number
This command comes in handy when you want to start-up a process that needs to bind to a particular port, but another running process is holding up that port. You can use lsof to find the PID of that process and kill it, should you have the permissions to do so.
No comments:
Post a Comment