A command that I really like to view what is going on is stop.
And because stop offers management options as well, if you want to use
these management options, then you might want to run it with sudo privileges.
But for viewing processes, that isn't even necessary.
So let's do a quick walkthrough of what we see starting on the top line, where we can see the amount of time that this system is up.
10 hours, 12 minutes and a couple of seconds.
We see the current time, we see the number of users currently active, and we see the load average.
The load average as we call it, is the average number of runnable processes.
That is a process that is candidate for asking attention from
the scheduler. So it needs to run on the CPU.
We have three figures for the last 1, 5 and 15 minutes and you can see they are all below 1.
So nothing is going on here.
If you want to know what is good for your system, you need to relate this to the number of CPU cores on your system.
Every CPU core can handle one process at a time. So on a one core system,
one is the highest that you should see. And on a 32 core system, 32 is
the highest theoretical capacity you see. Anything higher than that, you need further investigation.
Now you might be wondering how many CPUs do I have? Well, in top, if you press one
on the third and fourth line in this case you see a line for every single cpu.
So this is a two core system.
Then the second line is not very interesting. We can see the total number of processes and how many
of them are running. So we have one active process and most of them are sleeping in the background.
Then line number three is giving an indicator of what your processes currently are doing.
Probably the most interesting parameter is the ID for idle loop. This is a percentage of time that your system is doing nothing.
And if your system is doing something, you will see activity either in us or
in sy. That's for user space and system space, where user space is for non
privileged processes and system space is for processes that are running in kernel space.
High system space, for instance, might indicate a lot of activity by drivers.
Next we have memory usage.
Now the interesting thing in memory usage is that you can see the total amount of memory, the
amount of free memory and the amount of used memory. That's memory that's actively being used by programs.
Also we have buffers and cache. So this system has about a gigabyte of buffers and cache, and
the system is using that to make sure that memory is addressed in the most Efficient way.
What does that mean? Well, if you read a file from disk, before the file can be served to a user, it needs to be copied to memory.
Cache means that you keep it in memory as long as possible.
And if your file is still in cache, the next user that is going to need it can serve it from cache. And that's efficient.
BURFIS is mainly for writing. If you write data, then the data is stored temporarily in memory and from
memory it will be flushed to disk so that it can be written in the most efficient way.
Now, buffers and cache are mainly used for optimization of your system.
And a part of the buffers and cache is not really needed.
And that is why we have this available memory parameter.
In the available memory parameter we can see the amount of memory that can be liberated
immediately if we also dump the memory that is not really needed in buffers and cache.
And last, there is swap.
Swap is a little bit slower than memory. And how much slower that depends on your storage.
If you're on modern NVMe it's not that bad. If you're on an old rotating hard disk, then it
is significantly slower. The Linux kernel normally is using swap in a very efficient way and it is pausing
program memory that is not actively being used in the swap. And that's what we can see here.
It's using 351 megabytes of swap to moment.
Now notice that these highlighted parameters relate to swap. The
other one, the available memory is more the generic overview.
And last but not least, in top you see the top list of most active processes.
It refreshes every five seconds. So if you are looking for the most
active process sorted by CPU utilization, that's the one that is listed first.
And if you press uppercase M, you you would sort by memory utilization.
If you are looking for processes that are occupying a lot of memory.
And that concludes our quick walkthrough of the top utility.