UbuntuUbuntu Based

How To Check RAM Usage on Ubuntu

Check RAM Usage on Ubuntu

In the world of Linux system administration, monitoring resource usage is a fundamental practice to ensure optimal performance and prevent potential issues. Among the critical resources, RAM (Random Access Memory) plays a crucial role in the overall responsiveness and efficiency of your Ubuntu system. In this comprehensive guide, we will delve into the depths of monitoring RAM usage using the command line on Ubuntu. Whether you’re a seasoned sysadmin or a Linux enthusiast looking to learn, this guide will equip you with the knowledge and skills needed to effectively monitor your system’s RAM utilization.

Checking RAM Usage with Command Line

The ‘free’ command is your gateway to understanding the intricate details of your system’s RAM utilization. Its output provides a breakdown of several essential metrics that unveil the health of your RAM. Open up your terminal and enter the following command to witness the magic:

free -h

The output will display valuable information including:

  • Total: The total amount of installed RAM on your system.
  • Used: The portion of RAM is actively in use.
  • Free: The amount of RAM currently unallocated.
  • Shared: Memory is shared among various processes.
  • Buffers: Temporary storage for raw data before processing.
  • Cached: Cached data that can be quickly accessed.

Example Scenario 1: Low Free RAM

In a scenario where the Free RAM value is consistently low, it could indicate that your system is running out of available memory. This might lead to slower performance, especially when running memory-intensive tasks or applications. To address this, consider closing unnecessary applications or upgrading your system’s RAM if feasible.

Example Scenario 2: High Cached RAM

On the other hand, observing a significant value under the Cached RAM category is usually a positive sign. This indicates that your system is intelligently utilizing available memory by caching frequently accessed data, resulting in faster access times for those files. Linux is known for its efficient memory management, and caching is one of its standout features.

Monitoring RAM Usage Continuously

For those who want a real-time glimpse into their system’s RAM usage evolution, the ‘watch’ command comes to the rescue. This command allows you to repeatedly run another command and display its output at intervals. To continuously monitor RAM usage with the ‘free’ command, execute:

watch -n 1 free -h

Here, the -n 1 flag instructs ‘watch’ to refresh the output every second. This is incredibly useful for spotting sudden spikes in memory usage or detecting memory leaks that could impact your system’s stability.

Checking RAM Usage with ‘top’ Command

‘top’ is a powerful command-line utility that offers real-time insights into various aspects of your system’s performance, including RAM usage. To access the ‘top’ utility, simply enter:


Once inside, you’ll be presented with a wealth of information. To focus solely on memory-related details, press the ‘Shift‘ and ‘E‘ keys simultaneously. This will sort the processes based on their memory usage, with the most resource-intensive processes at the top.

Example: Identifying Resource-Hungry Processes

Suppose you notice a process consuming an unusually large amount of memory. In that case, you might want to investigate further by identifying the process’s name and PID (Process ID). This can help you decide whether the process is essential or if it requires termination to free up memory.

Analyzing RAM Usage with ‘htop’ Command

‘htop’ is a user-friendly alternative to the ‘top’ command, offering a visually appealing interface and advanced functionalities. To get started, install ‘htop’ if you haven’t already:

sudo apt install htop

After installation, run ‘htop’ by typing:


The interface is divided into sections, providing you with color-coded information about CPU, memory, and other resource usage. The horizontal and vertical scrolling allows you to explore the details effortlessly.


In the dynamic realm of Ubuntu system administration, monitoring RAM usage is a fundamental practice that should not be overlooked. Armed with the knowledge of command-line tools like ‘free’, ‘watch’, ‘top’, and htop, you have the means to keep your system’s RAM usage in check. Whether you’re identifying bottlenecks, optimizing performance, or simply satisfying your curiosity, these tools are your allies in maintaining a well-oiled Ubuntu machine.

By understanding the nuances of RAM utilization, you empower yourself to take informed actions that contribute to a smoother, more efficient computing experience. Embrace the command line, explore these tools, and embark on a journey of Linux mastery that will undoubtedly elevate your Ubuntu proficiency to new heights.

Back to top button