Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between 'Killed' and 'Terminated'

I was just testing kill switch flags with a sleeping process.

First i tried killed it with -15

 xtechkid@ubuntu:~/Desktop/expermiments$ ps cax | grep 10005
 10005 pts/2    S+     0:00 sh
 xtechkid@ubuntu:~/Desktop/expermiments$ kill -15 10005

And the process got terminated

 xtechkid@ubuntu:~/Desktop/expermiments$ sh testscript.sh
 This is a script which sleeps for few seconds ..
 Terminated

Then i killed it with - 9

 xtechkid@ubuntu:~/Desktop/expermiments$ ps -ef | grep testscript.sh
 xtechkid 10059  9852  0 13:48 pts/2    00:00:00 sh testscript.sh
 xtechkid 10064 10007  0 13:48 pts/4    00:00:00 grep --color=auto testscript.sh
 xtechkid@ubuntu:~/Desktop/expermiments$ kill -9 10059

And the process got killed

 xtechkid@ubuntu:~/Desktop/expermiments$ sh testscript.sh
 This is a script which sleeps for few seconds ..
 Killed

What is the difference ?

like image 561
Sudheej Avatar asked Oct 06 '13 06:10

Sudheej


People also ask

Does kill terminate the process?

Terminate the process. When no signal is included in the kill command-line syntax, the default signal that is used is –15 (SIGKILL). Using the –9 signal (SIGTERM) with the kill command ensures that the process terminates promptly.

What is the difference between kill and stop in Linux?

KILL and STOP are two commands in docker used to stop a container from execution. A docker STOP command issues a SIGTERM signal to the main process running within the container, while KILL command issues a SIGKILL signal to the process.

What is the difference between kill and kill 9 in Linux?

If the signal is not caught by a process, the process is killed. Hence, this is used for graceful termination of a process. “kill -9” command sends a kill signal to terminate any process immediately when attached with a pid or a processname. It is a forceful way to kill/terminate a or set of processes.

What is difference between kill and kill command?

The kill command works on the process ID (PID) and it kills the processes for which you provide the PIDs. On the other hand, the killall command works on the process name and it kills all the processes with the given process names.

What is the difference between kill and terminate a process?

To terminate a process means to cause it to die. The difference between kill and terminate is that kill generally refers specifically to sending a signal, whereas terminate usually also includes other methods such as sending the process a command that tells it to exit (if the process includes a command interpreter of some kind).

What is the difference between laid off vs fired vs terminated?

The Difference Between Laid Off vs. Fired vs. Terminated: Being fired means that the company ended your employment for reasons specific to you. This may also be referred to as “terminated” by some companies.

What is the difference between killing and murder?

• The most important distinction between a killing and murder is that of motivation and intent. A murder has the intent and is planned, whereas killing does not have intent. • You can kill animals but in case of human beings, you murder them.

Is it bad to use the word terminated in a sentence?

Avoid using the word “terminated” because it often implies that you were fired and not laid off, which is not what you want employers to think. Here are a couple more examples of what to say when you’ve been laid off:


2 Answers

The 'terminate' signal, SIGTERM, is a signal that can be intercepted in a program. Often processes which are meant to run in the background will catch this signal and start a shutdown process, resulting in a clean exit. The 'kill' signal, SIGKILL, cannot be intercepted. When this is sent to a process it will result in an abrupt termination of that program.

When you shutdown or reboot your computer for example, usually a SIGTERM is sent to the running processes first allowing them to exit in a clean way if they support it. Then, after a few seconds a SIGKILL is sent to the processes which are still running so that resources in use are forcibly released (e.g. files in use) and the shutdown sequence can continue (e.g. unmounting filesystems)

like image 196
brm Avatar answered Oct 05 '22 03:10

brm


Terminate : it will store all your data before shutting down (write data from RAM to disk, logs, etc)

Kill: It is more like pressing PC power and reset button. It wont save any logs or other data.

like image 31
madhur Avatar answered Oct 05 '22 04:10

madhur