Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Killing a process in linux [closed]

Tags:

linux

server01:/# ps -ax | grep java

Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html

 7342 pts/3    Z      0:00 [java] <defunct>

 7404 pts/3    S+     0:00 grep java


server01:/# kill 7342

server01:/# ps -ax | grep java

Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html

 7342 pts/3    Z      0:00 [java] <defunct>

 7406 pts/3    S+     0:00 grep java


server01:/# 

In the above I am using ps command to know the pid of the java process which is 7342 in the above case.

Then I killed that process using kill command. But that is not killed because again ps command shows java process with pid 7342.

Should I use some else command to kill the process and Why kill is not able to kill the process

Thanx

like image 549
sjain Avatar asked Jun 29 '10 11:06

sjain


People also ask

Does kill terminate the process?

The kill command sends a signal (by default, the SIGTERM signal) to a running process. This default action normally stops processes.

What happens when we kill a process in Linux?

The kill command sends the designated signal such as KILL process to the specified process or process groups. If no signal is specified, the TERM signal is sent. Please note that kill command can be internal as part of modern shells built-in function or externally located at /bin/kill.

How do I kill a sleeping process in Linux?

Terminating a Process using pkill or killall Command Alternatively, you can use the pkill or killall command to send termination signal to processes. The pkill/killall command requires you to specify the name instead of the PID of the process. For example, use the pkill command to terminate the dtmail process.


2 Answers

try

ps aux

then

kill -1 PID_NUMBER

to ask program to close itself, if it dosn´t answer you can force it to close

kill -9 PID_NUMBER

remember that using -9 to force program will finalize without asking and not saving anything check: man kill for more details

like image 191
fredcrs Avatar answered Nov 06 '22 06:11

fredcrs


kill -9 can be used as a last resort to ensure the process dies.....

like image 28
ennuikiller Avatar answered Nov 06 '22 07:11

ennuikiller