Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How will kill a process from redhat linux?

user-image
Question added by Muhammad Anzar , DevOps/DevSecOps Architect , Confidential
Date Posted: 2015/02/07
Deleted user
by Deleted user

Step-1:        ps -aux

                                       Then check Process ID (PID)

Step-2:       kill -9 PID 

Hesham Allam
by Hesham Allam , Technical Manager, Business Automation , Advansys-ESC

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

Roshan Firozkhan
by Roshan Firozkhan , IT System Administrator , Emirates Driving Institute

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

ghilman ahmed
by ghilman ahmed , System Administrator , Streaming Networks Pvt Ltd

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"

Rajesh Pant
by Rajesh Pant , System Engineer , Tech Mahindra Limited

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)

R e n z o V i d o n i
by R e n z o V i d o n i , Consultant , Various

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

Jerry John
by Jerry John , Devops Engineer , NeST Technologies

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).

Ahmed Riyadh
by Ahmed Riyadh , SysAdmin/SysEngineer (available and looking for open opportunity) , IQ network

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)    

 

Mohamed Rashad
by Mohamed Rashad , Technical Operation Owner , Orange Business Services

Kill -9 " process ID " , for more inf try kill --help

Mohammed Imran
by Mohammed Imran , Linux Server Administrator , Rightful Group Pvt Ltd

ps -aux | grep  (Service)

Killall -9 <name>

More Questions Like This