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
The kill command sends a signal (by default, the SIGTERM signal) to a running process. This default action normally stops processes.
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.
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.
try
then
to ask program to close itself, if it dosn´t answer you can force it to close
remember that using -9 to force program will finalize without asking and not saving anything check: man kill for more details
kill -9 can be used as a last resort to ensure the process dies.....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With