Linux Mint – Monitoring resource usage

How to set a static IP address on Windows Server 2019

In this section and the next, we’ll work through monitoring system resources for problems, and then we’ll even create a script to send us a handy message containing the results of our resources. This message is a handy monitoring tool.

Earlier in this chapter, the top command was mentioned briefly. The top command is one of the most useful commands to know, and simply typing top is enough for quite a few situations, to see what is currently happening on the system. The top command itself has a little bit more to it than just statically viewing resources. You can also change the sorting, view a single PID, or even kill a PID if you would like to do so.

When you first run the top command, the resources are sorted by the CPU percentage. This may be what you want if you were looking at finding out which process was consuming the largest amount of CPU. However, perhaps, you would like to sort the summary window by something else, such as memory consumption, should you find that your available memory seems to be lower than you would like. To sort by memory usage instead, press Shift + M on your keyboard. To sort by the PID, press Shift + N. To return to sorting by CPU usage, press Shift + P.

Additionally, you can kill processes as well. To kill a process, press K on the keyboard while top is open, and you will be prompted to type the PID number of the process you would like to kill.

Also, you can even change the time interval in which top updates the summary area. By default, the content in top updates every 3 seconds. You can actually change how often this updates by passing the -d flag and then a number of seconds, when first executing the top command. For example, consider the following statement:

top -d 1.5

With this example, top would update every 1.5 seconds. You could even set it to 0.5 seconds if you wanted to, in order to make it update even faster. The top utility is a very useful command, and one that you will likely find indispensable when attempting to pinpoint how much resources are being used up on your system and which process is the greediest one.

Comments are closed.