Search Tools Links Login

6 Easy Ways to Check Memory Usage on Linux

Monitoring memory usage on a Linux system is essential for ensuring optimal performance and diagnosing potential issues. Here are six easy ways to check memory usage on Linux:

  1. Using the free Command: The free command displays information about total, used, and free memory on your system, including both physical and swap memory.

    free -h

    This command will show memory usage in a human-readable format, making it easy to interpret.

  2. Using the top Command: The top command provides real-time information about system resource usage, including memory usage. It displays a dynamic view of processes and their resource consumption.


    Pressing "Shift + M" while top is running will sort processes by memory usage, making it easy to identify memory-intensive processes.

  3. Using the htop Command: Similar to top, htop is an interactive process viewer that provides a more user-friendly and customizable interface for monitoring system resources, including memory usage.


    htop allows you to scroll through processes, filter by memory usage, and easily kill or renice processes.

  4. Using the vmstat Command: The vmstat command reports virtual memory statistics, including memory usage, swap usage, and paging activity.


    By default, vmstat will display overall memory statistics since boot. You can specify an interval and a count to get periodic updates.

  5. Using the cat Command with /proc/meminfo: The /proc/meminfo file contains detailed information about memory usage on the system. You can use the cat command to display its contents.

    cat /proc/meminfo

    This will output a list of memory-related statistics, including total memory, free memory, and memory used for various purposes.

  6. Using the ps Command to Summarize Memory Usage by Process: The ps command can be used to list processes along with their memory usage. You can sum up memory usage across processes to get an overall view of memory consumption.

    ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head

    This command will list the top processes by memory usage, showing their process ID, parent process ID, command, percentage of memory usage, and percentage of CPU usage.

These six methods provide a variety of options for monitoring memory usage on Linux systems. Depending on your preferences and requirements, you can choose the one that best suits your needs, whether you prefer a simple command-line interface or a more interactive and visually appealing tool.

About this post

Posted: 2024-02-25
By: dwirch
Viewed: 56 times





No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.