Monitoring memory statistics is crucial for maintaining optimal performance on a Linux system. This article will explain you 5 Ways to Monitor Memory Usage on Ubuntu 20.04. If you intend to buy an Ubuntu VPS server, you can check out the packages offered on the Eldernode website.
Table of Contents
How to Monitor Memory Usage on Ubuntu Server
Regular monitoring of memory usage helps identify potential problems, resource bottlenecks, or memory leaks and allows you to take appropriate actions to optimize system performance. You can monitor Memory Usage on Ubuntu 20.04 with a few simple terminal commands. Also, they provide access to relevant information.
Method 1) Using the ”free” Command
The “free” command displays memory-related statistics, including total, used, free, and available memory. Also, you can use it to display Buffers and caches used by the kernel and swap memory in the system.
To display memory statistics in a human-readable format, run the following command:
The following command shows you memory usage and Total memory:
Method 2) Using the ”top” Command
The “top” command provides real-time information about system resources, including memory usage. It allows you to find the Process ID (PID) and use Process ID (PID) to kill or troubleshoot unwanted tasks. Also, it provides a limited interactive interface and a dynamic, real-time view of a running system.
You can launch this utility using the command below:
To view a comprehensive list of all available variations, run the following command:
The following command sorts usage per process by memory used:
top -o %MEM
Method 3) Using the ”htop” Command
The htop is similar to the top command and is an interactive process viewer that displays memory usage and provides detailed information.
If htop is not installed, you can install it by entering the following command:
sudo apt install htop
Use the following command to display memory and CPU usage per process:
Method 4) Using the ”cat” Command
The cat is a virtual file that contains real-time information about the system’s memory usage as well as the buffers and shared memory used by the kernel. It reports the amount of available and used memory.
To monitor memory usage on Ubuntu using the cat command, just run the following command:
Method 5) Using the ”/proc/meminfo” File
The /proc/meminfo is a file that helps you check the RAM memory usage in Ubuntu. It also allows you to view MemTotal, MemFree, Buffers, Cached, SwapTotal, SwapFree.
You can see the amount of RAM using the command less or cat along with /proc/meminfo as shown below:
Simple terminal commands help to monitor memory usage on Ubuntu. In this article, we taught you 5 ways to monitor memory usage on Ubuntu 20.04. I hope this tutorial was useful for you and that it helps you to monitor memory usage on your Ubuntu VPS server. You can contact us in the Comments section if you have any questions or suggestions.