You now that you know what to look for in top, let's talk about management
options in top. And in order to manage something, I'm going to run some processes.
Dd well, sudo I'm going to use sudo dd if is dev 0 of is
dev null and I want to run it as a background process and I want
to run it a couple of times, then I'm getting back to top. And as
I'm going to manage processes, I definitely need to run this with pseudo privileges.
So here we are back in top, and this time we can see that serious business is going on.
Load average is currently at 2.53.
And as you can see, there's a couple of DD processes that is quite
active, and that means that you might want to do something about it, because
all these active processes don't leave much space for other processes anymore.
The most common task that you might be interested in doing from top is to send a signal to your process.
The K command, which is short for kill, allows you to do that.
That sounds pretty bad, but really signal is an instruction. The first thing that
you are going to be asked after pressing K is which pid you want
to kill and it defaults to the top pid. And that's okay with me.
So I'm pressing enter.
So next we can see that it's asking for a signal. Now, what is a signal?
A signal is the instruction from the operating system, and by default
it's sending sigterm. And sigterm means process, you need to go away.
The process cannot ignore this request and that is why it will
be removed from the process table. That's what we see right here.
So killing is one of the things that you can do from top. Another thing that you can do from top
is change the process priority. So we can see a couple of dd processes right now. 3907, 3902 and 3964.
And in the third column we can see that all of them have a priority of 20.
Now, if you want to make one process more equal than
the other processes, you can use R for re. Nice.
So now it's asking for the pid that I want to renice. So I want to Renice 3907.
Let me press enter and then it's going to ask the value that we want to use.
Now when you are renicing, you can Renice from minus 20 to positive 19, where
minus 20 means that you are getting the highest priority. So it will go before
other processes and positive 19 means that you are lowering the priority of this process.
Well, I can see that 3907 is already quite busy as it is, so I
am going to give it positive 10 and then I'm pressing enter to apply that.
You should know that if you want to use a negative nice value,
you need to be a root user, so you need administrative privileges, and
ordinary non root users can only lower the priority of their processes.
So here we go. You can see that 3907 has changed its priority and now it's listed in
the third column with a PR, which is priority of 30 and a nice value of 10.
And as you can see, it's almost disappearing. And that's what you can do in top to manage your processes.
Let me use Q to get out of there, because for now this is enough about top.