Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
Then check Process ID (PID)
if you know which process ID "PID" you wanna to kill so just use kill command along with PID number and you can use kill different signals "check the man"
kill12231 -->12231 sample for process ID
if you don't now the PID so check process ID with ps command or you can use top command as well
to force kill any PID use
kill -s91231
list all running processes and foind the pid of the process which you need to kill
#ps -aux
or
#top -c
Kill the process by
kill -9 pid
First grep the process pid using below mentioned command and then use a kill command with pid of the process.
ps -ef | grep "pid"
kill "pid"
First need to find out PID of (e.g. httpd) process then use below command to kill :#ps aux | grep httpd (OR#pidof httpd)#kill [signal] PID (e.g. #kill -9 PID)
I can see correct and short answers but I would do like to write also my way:
to kill a single process I use top (display Linux processes) that is a Red Hat Linux tool but it's common in any Linux distribution and in other BSD OS.
With top you can search a process by name (Shift + L = Locate string) or order process by CPU usage (Shift + P).
Than after reading the PID of the process to kill hit the 'K' key, insert the PID and the sigterm '9' to terminate the process.
Note that kill send a signal to a process, there are different SIGnals, for a complete list on your system: kill -l (in some OS use kill -L)
usage: kill -SIGKILL PID (e.g., kill -9 ProcessID)kill -9 PID
kill only a specific instance of a process so to kill all the instances of a process use the process' name and killall:
killall (kill processes by name. E.g., killall -9 nano)
I use killall also to stop (killall -23 process name) and restart a process (killall -25 process name)
Or kill SIGHUP (killall -1 process name) to reload daemons' configuration files and reopen their logfile (not always working: it's related how was compiled the daemon).
Another handy use of top is to Re-Nice a process:
Read the PID of the process, hit the 'R' key, insert the PID and the 'N' value to nice it to. 'N' is the priority value, default is20.
Wikipedia have a page about the SIGnal (Unix signal) (http://en.wikipedia.org/wiki/Unix_signal)
top is amazing software and can do more so for info: man top and man kill, man killall, man nice, man renice
Kill can be done using different commands:killall, pkill and options can be selected by the way you want to kill it.(-9,-15 etc).
1. previously say which process you are going to kill ( by its name for example )
2. find the process ID , you can invoke ps -ef | grep "process name"
3. once you get the name look at the second column which tells about PID
4. use "kill PID" to get ride that process save way ( this is the default kill command will send single)
5. if could not use the default command mentioned above the go to "kill -9 PID" this will kill the process then give you bad or rubbish content if you kill it from "top command as example" so better to open new tty then do that command
6. take my magic way to kill any process from shell prompt :
kill $( ps -ef | grep "^user-account.name"| awk print $2)
Kill -9 " process ID " , for more inf try kill --help
ps -aux | grep (Service)
Killall -9 <name>