How to Check CPU Usage on a Server?

When managing a server, it’s important to monitor its performance, including CPU usage. This will help avoid malfunctions and ensure the stable operation of your server. But how do you know how loaded your CPU is? Let’s figure it out together.

There are several ways to check CPU usage on a server. Below we will look at the most popular ones:

1. Using the top command

First, open the terminal and execute the command top. This command will show us the current CPU usage, as well as other important system indicators. You will see a list of processes with information about CPU usage, memory, and other resources.

To exit the data viewing mode, press the q key. You can also use additional keys to customize the output, for example, -u to filter by user or -p to display information about a specific process.

2. Using the sar command

Another way to monitor CPU usage is to use the sar utility. This command allows you to view the CPU usage history for a certain period of time.

In order to use the sar command, you need to install the sysstat package. After installing the package, enter the command sar -u to get information about CPU usage.

3. Using the htop program

The htop program provides a more convenient and informative interface for monitoring CPU usage on the server. It allows you to view processes in real time, sort and filter them according to various criteria.

To run the htop program, simply enter this command in the terminal. You will see an interactive window with detailed information about CPU usage and other resources.

Use these methods to monitor CPU usage on your server and stay informed about the current state of the system. This will help you detect problems early and prevent malfunctions.