1
00:00:06,599 --> 00:00:09,890
In this video we'll talk about the
way how you can manage processes with Kill.

2
00:00:10,949 --> 00:00:15,869
So how does that work? Well, Kill is used
to send signals to a process based on the pid.

3
00:00:17,070 --> 00:00:22,399
Kill all is a convenient command line utility that
can do the same, but it's based on process name.

4
00:00:23,140 --> 00:00:26,269
You have already seen me using
killall DD a couple of times.

5
00:00:27,440 --> 00:00:32,979
Common signals are signal 15, which is sick
term, and that instructs the process to stop.

6
00:00:34,039 --> 00:00:39,729
This is a nice signal because the
process will have time to finish its work.

7
00:00:40,270 --> 00:00:45,500
Signal 9 is not so nice because that will
force the process off and nothing will be stopped.

8
00:00:47,179 --> 00:00:51,950
Other signals are specific to the commands that you are
running. You won't run them very much. You know what

9
00:00:51,950 --> 00:00:56,719
I want to do? I want to show you
the difference between signal 9 and signal 15 from top.

10
00:01:00,960 --> 00:01:07,950
So here I'm going to start top again and I'm pressing K. Now
the process that I want to kill is process 7148. That is top itself.

11
00:01:11,299 --> 00:01:17,314
And next it's asking for a signal. And the
default signal that it wants to send is signal 15,

12
00:01:17,314 --> 00:01:23,329
which is Sigterm. And sigterm is just fine with
me. So I'm pressing enter and now it's gone.

13
00:01:23,810 --> 00:01:29,746
Now what is the point that I want to
make? Well, the point that I want to make

14
00:01:29,746 --> 00:01:35,683
is that if we do it again, this time
7211, which is stop again and I'm going to

15
00:01:35,683 --> 00:01:41,620
send it signal nine, then this is what
is happening. You see what's happening? Nothing is cleaned.

16
00:01:42,060 --> 00:01:48,640
Now this is a very clear demo that signal 9
doesn't allow the process to clean up anything at all.

17
00:01:49,739 --> 00:01:55,294
The result is that if you use Signal
9 on important applications, you might cause some

18
00:01:55,294 --> 00:02:00,849
damage here. So don't use signal 9, at
least not before you have used signal 15.

19
00:02:02,250 --> 00:02:08,300
If you do a signal 15, you wait a couple of minutes and the
process is still there, then it might be okay to do a signal 9.

20
00:02:09,300 --> 00:02:11,849
But normally you should
try to avoid signal 9.

21
00:02:12,849 --> 00:02:19,295
In case you wonder how can we clean up the
screen. Well, just use clear. Clear is the magical command

22
00:02:19,295 --> 00:02:25,740
that will always work and it will clear your
screen. And as you can see, little bit stronger reset.

23
00:02:26,180 --> 00:02:31,629
If the screen output is really a mess,
then you use reset to regenerate new prompt.
