Which problem I have faced several time in linux that is I want to kill a specific port process ID(PID). But its difficult to find the process to check in the console. Run following command in the terminal to see the all process run in linux.
If you run the command you will see like that(see the image)
If you want to kill a process identification number(PID) just run the following command in terminal
- sudo - command to ask admin privilege(user id and password).
- kill - command to kill the process
- -9 - forcefully
- PID - process identification number that you want to kill
If you want to kill PID 30 then command will be:
Sometimes I fed up with searching my program PID. As you know the port number so you can easily find the port PID and kill it. If you want to kill a process running on port number 8000 then first you need to find the PID and then kill it. Run the following command to find port number PID:
- lsof - list of files(Also used for to list related processes)
- -t - show only process ID
- -i - show only internet connections related process
- :8000 - show only processes in this port number
So you can now easily kill your PID. One command to to kill a process on a specific port use the following command:
Note: If you have any query or any upgradation of my writing or any mistakes please comment and suggest me. You are warmly welcomed always.