How To Monitor Your CPU and RAM in Linux (2024)

Whether we’re using a Raspberry Pi or a data center server, we need to know how our CPU and RAM are performing and, in Linux, there are a plethora of commands and applications that we can use. At the basic low level “How much RAM have I used?” to inspecting the CPU for vulnerabilities such as Spectre, there are commands at our disposal.

We are going to look at a number of different ways to get RAM and CPU data in the terminal, before we finally look at two applications which can provide a basic level of assurance, at a glance.

These commands will work on most Linux machines. Our test PC ran Kubuntu 21.10 but we are also certain that you can also run through this how-to on a Raspberry Pi. All of the how-to is performed via the Terminal.

How to Check Your CPU in Linux

1. Open a terminal.

2. Use the cat command to display the data held in /proc/cpuinfo.

cat /proc/cpuinfo

How To Monitor Your CPU and RAM in Linux (1)

This command will produce a lot of text, typically it will repeat the same information for the number of cores present in your CPU.

A more concise means to get most of this information is via lscpu, a command that lists the CPU details.

Stay on the Cutting Edge

Join the experts who read Tom's Hardware for the inside track on enthusiast PC tech news — and have for over 25 years. We'll send breaking news and in-depth reviews of CPUs, GPUs, AI, maker hardware and more straight to your inbox.

1. Open a terminal.

2. Use lscpu to display the CPU details. The command is quite verbose and we can easily see the number of CPU cores, minimum and maximum CPU speed and the CPU architecture.

lscpu

How To Monitor Your CPU and RAM in Linux (2)

Using a little grep magic we can pull out just the information that we need.

1. Open a terminal.

2. Using a vertical pipe, send the output of the lscpu command to grep and search for “max”. This will give us the maximum possible CPU speed. Pipes are a way to send the output of one command as the input for another. Classic examples are piping the output of a command to a text file for later review.

lscpu | grep max

Another means to get CPU information is using dmidecode, a command that dumps the DMI (SMBIOS) contents into something we can understand.

1. Open a terminal.

2. Type in the dmidecode command using sudo, and the argument -t 4. There are many DMI types, with a numerical reference used to pull information for that component. In this case -t 4 is for the CPU. We can replace the 4 with processor for the same effect.

sudo dmidecode -t 4

How To Monitor Your CPU and RAM in Linux (4)

How to Check Your RAM in Linux

1. Open a terminal window.

2. Use the free command. This will show the available memory, and how the memory has been allocated, in Kilobytes.

free

How To Monitor Your CPU and RAM in Linux (5)

3. Use the -m switch to show the available memory in Megabytes, or -g for Gigabytes.

free -m

How To Monitor Your CPU and RAM in Linux (6)

Alternatively use the -h switch to show the memory information scaled to the three shortest digits. Giving us at a glance information.

free -h

How To Monitor Your CPU and RAM in Linux (7)

There is a similar way to /proc/cpuinfo for memory information.

1. Open a terminal window.

2. Use the cat command to print the contents of /proc/meminfo. The output is incredibly verbose and can prove useful for debug. In general use we would stick with free -m.

cat /proc/cpuinfo

How To Monitor Your CPU and RAM in Linux (8)

If we need to know the timings and breakdown of memory modules in a machine then we can use lshw.

1. Open a terminal window.

2. Using sudo, issue the lshw command with the -short switch (the device tree) and -C with the class memory.

See Also
FAQ

sudo lshw -short -C memory

How To Monitor Your CPU and RAM in Linux (9)

We can also use dmidecode for a more detailed query.

sudo dmidecode -t memory

How To Monitor Your CPU and RAM in Linux (10)

Information at a Glance

Should we need a more general level of information, our current CPU speed, RAM usage, network bandwidth then we have two commands which can be installed.

How to Install and Use Htop

How To Monitor Your CPU and RAM in Linux (11)

The standard top command is great, but htop is a much better alternative. Htop provides us with an interactive list of running processes.

To install htop.

1. Open a terminal window.

2. Update your list of repositories.

sudo apt update

3. Install htop using apt.

sudo apt install htop

4. Run htop.

htop

How To Monitor Your CPU and RAM in Linux (12)

At the top of the window we can see the utilization of our CPU cores, under that is our RAM, and finally is the swap.

How To Monitor Your CPU and RAM in Linux (13)

We can scroll through the list with our cursor keys or search using F3 followed by the name of a process or application. Here we have searched for the GNU Image Manipulation Program (GIMP). We can kill the app by pressing F9.

To close htop, press F10.

How to Install and Use Bpytop

How To Monitor Your CPU and RAM in Linux (14)

Our personal preference is bpytop, a Python implementation of htop but with much more to offer.

To install bpytop.

1. Open a terminal window.

2. Install bpytop using the Python package manager pip.

sudo pip3 install bpytop

3. Run bpytop from the terminal.

bpytop

Bpytop’s interface is split into a series of areas.

How To Monitor Your CPU and RAM in Linux (15)

1. CPU Status
a. CPU Speed
b. Core utilization
c. Overall utilization

2. RAM Usage
a. Total RAM
b. Used RAM
c. Available RAM
d. Cache

3. Disk / Storage Usage
a. Used and free space on all mounted devices

4. Network Interface Usage
a. Up and down speeds

5. Processes (just like htop)
a. Process management

How To Monitor Your CPU and RAM in Linux (16)

We can show or hide an area by pressing the corresponding number (1..4). If we just wanted CPU, RAM, storage and Network information then we press 4. To bring it back, press 4 again.

To filter the processes for a particular application.

How To Monitor Your CPU and RAM in Linux (17)

1. Press f to filter. It has to be lower case f.

2. Type in the application / process name / Pid. The search will adapt to show the process, in our case GIMP.

3. Press T to terminate the process, or K to kill. These have to be upper case T and K.

To exit bpytop press q at any time.

How To Monitor Your CPU and RAM in Linux (2024)
Top Articles
From My Bloody Valentine to Slowdive: The 50 best shoegaze albums of all time - Far Out Magazine
Walkthrough - Harry Potter Hogwarts Mystery
Xre-02022
Public Opinion Obituaries Chambersburg Pa
Exam With A Social Studies Section Crossword
Health Benefits of Guava
Doublelist Paducah Ky
Dark Souls 2 Soft Cap
My.doculivery.com/Crowncork
Craigslist Estate Sales Tucson
DIN 41612 - FCI - PDF Catalogs | Technical Documentation
Hssn Broadcasts
Ivegore Machete Mutolation
Hood County Buy Sell And Trade
Moonshiner Tyler Wood Net Worth
Craigslist Farm And Garden Tallahassee Florida
Costco Gas Foster City
Paychex Pricing And Fees (2024 Guide)
Las 12 mejores subastas de carros en Los Ángeles, California - Gossip Vehiculos
De beste uitvaartdiensten die goede rituele diensten aanbieden voor de laatste rituelen
ZURU - XSHOT - Insanity Mad Mega Barrel - Speelgoedblaster - Met 72 pijltjes | bol
Blue Rain Lubbock
Graphic Look Inside Jeffrey Dahmer
Xsensual Portland
Www.publicsurplus.com Motor Pool
Happy Homebodies Breakup
How to Watch Every NFL Football Game on a Streaming Service
Craigs List Jonesboro Ar
Boxer Puppies For Sale In Amish Country Ohio
WRMJ.COM
San Jac Email Log In
Quality Tire Denver City Texas
Exploring TrippleThePotatoes: A Popular Game - Unblocked Hub
Rocketpult Infinite Fuel
Marie Peppers Chronic Care Management
Aveda Caramel Toner Formula
Puretalkusa.com/Amac
Mid America Clinical Labs Appointments
Weather In Allentown-Bethlehem-Easton Metropolitan Area 10 Days
Autum Catholic Store
Blow Dry Bar Boynton Beach
Costco The Dalles Or
Oakley Rae (Social Media Star) – Bio, Net Worth, Career, Age, Height, And More
Gander Mountain Mastercard Login
How to Find Mugshots: 11 Steps (with Pictures) - wikiHow
Smoke From Street Outlaws Net Worth
Spn 3464 Engine Throttle Actuator 1 Control Command
Evil Dead Rise - Everything You Need To Know
Is Chanel West Coast Pregnant Due Date
Blippi Park Carlsbad
Latest Posts
Article information

Author: Kieth Sipes

Last Updated:

Views: 6424

Rating: 4.7 / 5 (47 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Kieth Sipes

Birthday: 2001-04-14

Address: Suite 492 62479 Champlin Loop, South Catrice, MS 57271

Phone: +9663362133320

Job: District Sales Analyst

Hobby: Digital arts, Dance, Ghost hunting, Worldbuilding, Kayaking, Table tennis, 3D printing

Introduction: My name is Kieth Sipes, I am a zany, rich, courageous, powerful, faithful, jolly, excited person who loves writing and wants to share my knowledge and understanding with you.