How to Check CPU Usage on a VPS?

If you’re managing a Virtual Private Server (VPS), you probably know how important it is to understand how your CPU time is being used effectively. This can help you optimize your server’s performance, improve the performance of your web applications, and save money by not buying unnecessary computing power.

There are several ways to check the CPU usage on your VPS. Below, we’ll look at a few of them.

1. Using the top command

The top command is a command-line utility that allows you to monitor CPU usage, memory, and other system resources in real-time. To run the command, simply enter top in the terminal.

Once running, you will see a dynamically updating table with information about the processes using CPU time, including the percentage of CPU usage. To exit the utility, press the «q» key.

VPS Hosting

Virtual servers with guaranteed resources

Choose VPS

2. Using the htop command

htop is an improved version of the top utility, providing more detailed and user-friendly information about system load. To install htop, run the command sudo apt-get install htop, and then run the utility by typing just htop.

In the htop interface, you will see a CPU load diagram, a list of processes with the percentage of CPU usage, and other useful data. To exit the utility, use the «q» key.

3. Using the sar command

The sar utility provides statistics on system resource usage, including CPU time. To install sar, run the command sudo apt-get install sysstat, and then run sar using sar -u.

With sar, you can view and analyze the history of CPU usage, which can be useful for identifying peak loads and optimizing processes.

Conclusion

Knowing the CPU usage on your VPS will allow you to manage your server more efficiently and improve the performance of your applications. Use the above methods to always be aware of the current state of your server.