How to check CPU utilization in Linux?

You can check the CPU usage in a Linux system by using the following command:

  1. The top command allows you to monitor system processes and CPU usage in real-time by inputting it in the terminal. By default, the top command displays a list of processes sorted in descending order of CPU usage.
  2. htop command: htop is an interactive process viewer that offers more features and a friendlier interface. You can install htop using package managers like apt-get or yum. Simply input the htop command in the terminal to launch this tool and monitor CPU usage in real time.
  3. mpstat command: mpstat is a member of the sysstat tool package which can be used to obtain CPU status information of the system. By typing the mpstat command in the terminal, you can view the current system’s CPU statistics, including usage rates and idle rates for each CPU.
  4. The sar command is a member of the sysstat tool suite, used to collect and report system performance data, including CPU usage. By entering the sar command in the terminal, you can view the historical records of CPU usage on the system.

In these commands, top and htop are tools that display real-time CPU usage, while mpstat and sar can provide more detailed statistical data. You can choose the tool that best suits your needs for usage.

广告
Closing in 10 seconds
bannerAds