Close Menu
Technoracle
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    TechnoracleTechnoracle
    • Home
    • AWS
      • EC2
      • Lightsail
      • RDS
      • S3
    • Ubuntu
      • Ubuntu 20.04
      • Ubuntu 22.04
    • AI Tools
    • Web Hosting
    • WordPress
    • Tech News
    Technoracle
    Home - Uncategorized - How to Check CPU Usage in Linux Easily
    Uncategorized

    How to Check CPU Usage in Linux Easily

    Rajesh ShivamBy Rajesh ShivamMarch 26, 2022No Comments3 Mins Read
    How to Check CPU Usage in Linux

    Analyzing CPU usage is very important for the smooth running of any system. Sometimes CPU usage reaches 100% and due to that CPU becomes unavailable for processing other requests until the CPU becomes free. There may be multiple reasons behind high CPU usage, such as Programs with higher CPU requirements, autostart programs, multiple opened tabs of browsers, and many more reasons. In this tutorial, I am going to explain how to check CPU usage in Linux and the causes of high CPU usage in Linux. So, let’s get started.

    Page Contents

    Toggle
    • How to Check CPU Usage in Linux
      • Top command (Most common method)
      • Check CPU Usage using htop
      • CPU Activity Check using mpstat Command
    • Conclusion

    How to Check CPU Usage in Linux

    There are plenty of tools and commands to monitor CPU Usage. Let’s start with the most popular command top to find out CPU usage in Linux. In this article, I am going to discuss commonly used methods to check CPU usage.

    Top command (Most common method)

    The top command provides a real-time view of the system. It displays CPU utilization, process statistics, threads details, uptime, swap space, etc. All the data are filterable by size, type, and order.

    Open terminal from the application launcher or press (control + alt + t) on the keyboard. Now, run the top command.

    $ top

    The top command will show all the running processes, threads, system uptime, number of users, the total number of running tasks, etc. To exit from top, press Q on the keyboard.

    Sample output of top command.

    top command output

    Now let’s see how we can check the information one by one by sorting the top command with options.

    Some Important Top Command Options to Check CPU Usage

    OptionsDescription
    PSort processes by CPU usage
    IRemove idle processes
    SSort the list by how long processes have been running
    Msort task list by memory usage
    Tsort task list by run time
    Nsort task list by process id

    To access the help manual of the top command, run following command.

    $ man top

    Check CPU Usage using htop

    Htop is more like an improved version of top command with more interactive, graphical, and easier to read than top command. Htop allows you to kill the processes without PID, it makes it easier to sort the process based on the usage, etc. To install htop on the Ubuntu system, run the following command.

    $ sudo apt install htop

    Once the installation completed. Run the htop command.

    $ htop

    Sample output.

    htop command output

    Learn more about htop here.

    CPU Activity Check using mpstat Command

    The mpstat command writes to standard output activities for each available processor. Most of the RHEL based operating systems include mpstat by default. In Ubuntu, you need to install sysstat to use mpstat. Run the following command to install sysstat.

    $ sudo apt install sysstat

    Once the installation is completed, run mpstat command to check the CPU activity details.

    $ mpstat

    You should get the following output.

    mpstat command output

    To print from the first processor (0 is the first one) with option -p and ALL will list all the CPU statistics. The command is

    $ mpstat -P ALL

    Output.

    how to check CPU usage in Linux

    Conclusion

    In this article, you have learned how to check CPU usage in Linux. If you have any doubts feel free to contact me, I will definitely try to help you. Also, you can join our elite facebook group to get direct help from me. If you like this tutorial, please share this article on your social media handle.

    ubuntu tips
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit
    Previous ArticleHow to Upload File to AWS EC2 Instance
    Next Article How to Setup Ubuntu Firewall Easily
    Rajesh Shivam
    • LinkedIn

    Rajesh Shivam is a seasoned professional with expertise in AWS and Linux System Administration. With over 10 years of freelancing experience, he brings a wealth of knowledge to the table. Rajesh has a strong passion for technology and stays connected with the latest happenings in the field. His dedication and expertise make him a trusted resource for all things tech-related.

    Related Posts

    linux commands every user should know in 2025
    Ubuntu 24.04

    25 Must-Know Linux Commands Every User Should Master in 2025

    Read More
    Blog banner showing Ubuntu logo, coding laptop, and icons for VS Code, Docker, and Git with the title 'Perfect Dev Setup in Ubuntu 24.04 – Step-by-step guide for developers' on a dark tech-themed background.
    Ubuntu

    How to Set Up the Perfect Development Environment on Ubuntu 24.04

    Read More
    Uncategorized

    How to Get your First Order On Fiverr in 2024 – 5 Proven tricks

    Read More
    Add A Comment
    Leave A Reply Cancel Reply

    linux commands every user should know in 2025

    25 Must-Know Linux Commands Every User Should Master in 2025

    April 10, 2025
    TeamViewer and Ubuntu logos on gradient background – banner for how to install TeamViewer on Ubuntu 24.04 tutorial

    How to Install TeamViewer on Ubuntu 24.04 [Fast & Easy Steps]

    April 10, 2025
    Troubleshooting ‘Permission Denied (publickey)’ SSH error on a Linux server using secure terminal access

    Fix ‘Permission Denied (publickey)’ SSH Error on Linux [Step-by-Step Guide]

    April 8, 2025
    Blog banner showing Ubuntu logo, coding laptop, and icons for VS Code, Docker, and Git with the title 'Perfect Dev Setup in Ubuntu 24.04 – Step-by-step guide for developers' on a dark tech-themed background.

    How to Set Up the Perfect Development Environment on Ubuntu 24.04

    April 8, 2025

    Subscribe to Blog

    Enter your email address to subscribe to
    this blog and receive notifications of new posts by email.

    Facebook X (Twitter) Instagram Pinterest
    • Sitemap
    • Privacy Policy
    • Disclaimer
    • Term of Services
    © 2025 Technoracle

    Type above and press Enter to search. Press Esc to cancel.

    Click to Copy