Postmodern Studio/Shutterstock
By Brad Hill/April 30, 2024 6:15 am EST
Raspberry Pi is a versatile single-board computer that can be used to create your own Raspberry Pi media center or improve your hangout space, among various other uses. While a Raspberry Pi won’t replace your desktop computer if you use it for more than simple web browsing, it can be a helpful tool to accomplish some simple tasks. No matter what you’re using a Raspberry Pi for, it’s important to be able to check the CPU and RAM utilization of the board.
Knowing how much memory and CPU is being used on your computer is useful information if you want to add a new task for the device to accomplish, or troubleshoot when things aren’t running as smoothly as they once were. Raspberry Pis can’t be modified to accommodate more RAM, so if things aren’t functioning properly and it’s because of the RAM or CPU, you may need to purchase a more efficient model. And the best place to start troubleshooting is seeing which tasks are utilizing the most memory.
Since Raspberry Pi OS is a version of the Linux operating system, checking CPU and RAM usage isn’t always as straightforward as the majority of computer users are used to with things like Windows or Mac. Sometimes, you can use a mouse like you’re used to, and other times, you can only use the keyboard because there isn’t a traditional desktop to navigate.
Just like a Windows desktop
trickyaamir/Shutterstock
For those who have Raspberry Pi with Desktop, it’s not much different than checking the RAM and CPU usage on a Windows PC. The first step is to click on the little Raspberry symbol in the top-left corner of the screen. That will bring up the main menu with multiple options: From there, scroll over the Accessories label and another menu will appear. Click on “Task Manager,” and it will bring up a window with all the information.
The Task Manager will display two meters at the top that show the CPU and RAM usage, along with the processes running and how much of each they’re using below. In the meter bars at the top of the menu, CPU usage is shown in a percentage, while memory is measured in megabytes. However, when looking at how much each program is using individually, the memory is displayed in Resident Set Size (RSS).
‘Free’ the command line
mattcabb/Shutterstock
Not every Raspberry Pi OS has a graphical interface, which is how the majority of computer users are accustomed to interacting with programs and functions. For example, those with Raspberry Pi OS Lite won’t have the use of a mouse to navigate the operating system. Instead, they see the command line rather than a typical desktop with icons and a wallpaper. However, it’s still possible to check CPU and RAM usage this way.
If using the command line, simply type in the command “Free” and an overview of the memory usage will appear. The data displayed here will show the total memory, how much is being used, and the amount still available. There’s also a row displaying the different totals for swap. Think of the swap file on a Raspberry Pi as additional RAM — it’s virtual memory that kicks in when the device is at its memory limits.
Unfortunately, the “Free” command doesn’t display the processes using memory. To get a detailed look, use the “ps” command and the terminal will show all the tasks using up memory in a column labeled “%MEM.”
Command top
mattcabb/Shutterstock
The Terminal is a quick and easy way to navigate directories in a Linux system. Every computer has a terminal, and it’s especially easy to access on a Raspberry Pi. Raspberry Pi with Desktop has a Terminal button in the taskbar. Click on that, and it opens up a new window where users can type simple commands to navigate file directories and utilize different programs. Another way to access the Terminal is by going to the main menu, clicking on Accessories, and selecting Terminal.
While the “free” command is a simple way to look at memory usage on a Raspberry Pi, it doesn’t display CPU usage. For that, you can type “top” into the command line and get a detailed look amount of the CPU and RAM being used. They’ll be displayed in the columns labeled “%CPU” and “%MEM.” You can sort the different data points by pressing Shift + M, and it will prioritize the most demanding processes at the top.
An updated version of the “top” command is “htop.” This command is similar to “top,” but it adds a splash of color to make things easier to read, as well as a continual update of the metrics. Sometimes “htop” isn’t pre-installed on Raspberry Pi, but it’s easy enough to install it. If you’re Raspberry Pi doesn’t have the “htop” command by default, simply open up the command line and enter the command “sudo apt install htop.” Once that’s done, you only need to type in the command “htop” from now on.
>>> Read full article>>>
Copyright for syndicated content belongs to the linked Source : SlashGear – https://www.slashgear.com/1569801/how-to-check-raspberry-pi-5-cpu-ram-and-usage/