How to Check Memory Usage in Linux?

How to Check Memory Usage in Linux?

If you have recently switched to the Linux operating system or are new to the Linux operating system, then you need to understand where your memory and CPU usage stand. In this tutorial, we will provide information about how to check memory usage in Linux. These methods are the same for all Linux operating systems and this method doesn’t target any specific Linux operating system.

There are a two ways to check the Linux computer RAM. Check the RAM with GUI (Linux Desktop) and check the RAM usage through the terminal. Use both methods to check the RAM.

Check Memory Usage in Linux With Desktop

If you use a Windows computer, you can easily understand this. It's similar to the Windows Task Manager, but it's known as "System Monitor" in the Linux operating system. By using the System Monitor, you can check active processes, resources, and file systems. To run this, you can go to the Application Menu in the Linux desktop. In my case, I am currently using Ubuntu 23:10 as the operating system. You can use any operating system and open the "System Monitor" software. More information is available in the screenshot.

From the First Screenshot, you can:

  • Show the Active Processes List.
  • Check memory Usage, CPU Load used Units, and Priority Details of Active Services.
  • Use this Panel to Modify the Priority of Any program and close any Program by Skill.

From the second screenshot, you can show the part resources. From the resources panel, you can show the CPU Usage graph, Memory Usage graph, and Network Bandwidth Data Send and Received Information.

From the Third Screenshit you can show the File System Informations. From this Panel show the Active Disk Partitions, Directory, Available and Used Storage with Percentages.

Now We can Check Memory Usage With Terminal.

Check Memory Usage In Linux With Terminal

There are 4 ways to check the memory in Linux. You may have a question in your mind like, "If we can check the memory usage directly, then why should we use the terminal for checking the RAM?" This method also works for checking the load of our self-hosted sites, like a custom-coded site with Apache Server or a web application like WordPress or Ghost. In this case, if you don't have desktop access, you can access the terminal over SSH services. Now we can test the possibility to check memory usage over the terminal server.

Check Memory with htop Command

This command looks like a high-end terminal interface with green color effects. It allows you to have a live experience. To make the interface look like a professional Linux user interface, use the following command to show:

htop
Check memory usage with htop command in Linux

It displays the program ID of the software in the terminal. You can show the number of active tasks, CPU, and memory usage of the program. before the uptime of the current system and determine which user can run this program. Additionally, you can use the F1 to F10 function keys to apply changes in your system. To exit from this interface, you need to press the F10 key to quit from the htop interface.

Check Memory Usage with Cat Command

Cat Command is basically used to view and check the content of a file without opening it. The cut Command targets a specific directory or file location. Use the given command to check its usage.

cat /proc/meminfo
Check Memory usage in Linux with cat Command

All the available memory processing data is stored at the /proc/meminfo directory. By using the cat command to display all the data, you can show the total memory, free memory, available memory, and more data.

Check Memory Usage with Free Command

This is an easy and short way to think. It is a method for checking the process of Limyx Server. To show the quick data of the system, you need to put the "free" command on the Linux Terminal. This command will provide information about the system's memory usage and other related data.

memory status with free command

By using this command, you can show the total available memory, used memory, free memory, and swap data of memory.

Check Memory Usage with vmstat Command

Vmstat Command is too similar to the free command, but one of the major differences is that it can display the active processes, memory, system, and CPU details quickly. Use the given command to check vmstat.

vmstat
memory usage data with vmstat command

From the given screenshot, you can show the current process details of my Linux system. This command does not show the live data of system usage. It can provide the information when the system is executing this command.