Whether you’ve just noticed some sluggishness on your VPS or you’ve run into a situation where you’re using more than your fair share of your shared resources, there might come a time when you need to figure out which processes are taking up the most CPU/RAM.
Linux installations come with a bevy of tools that are acceptable for this purpose, but none are quite as universal as top. Or, for those who like a little more interactivity, htop.
By default, top displays the most CPU intensive processes currently running on your VPS. It will update the list every 3 seconds so that you can understand if a process is spiking CPU usage every so often or is a consistent hog.
You can use a number of different options while running top to customize its output.
Specify the refresh period, in seconds. The below command will change the period to 10 seconds.
top -d 10
Sort by specific column. First, type top -O to see which columns are available to you, then use top -o to specify. For example, you can search by TIME to see which processes have been running longest.
top -o TIME
Or based on CPU usage.
Continue reading this article by subscribing to our newsletter.