How to kill a process on a port on Mac/Ubuntu/Linux/Unix



The Best way do that:

To kill a Process running on port number 9001

 sudo kill -9 $(sudo lsof -t -i:9001)lsof   - list of files(Also used for to list related processes)-t     - show only process ID-i     - show only internet connections related process:9001  - show only processes in this port numberkill   - command to kill the process-9     - forcefullysudo   - command to ask admin privilege(user id and password).