How to Monitor Memory Usage in Linux


 Introduction


Monitoring memory usage helps ensure your Linux system runs efficiently and avoids crashes due to memory exhaustion.


Step 1: Use the free Command


free -h


➡️ Shows total, used, and available memory in human-readable format.


Step 2: Use the vmstat Command


vmstat 2 5


➡️ Displays memory, CPU, and system performance statistics.


Step 3: Check Memory Usage per Process


ps aux --sort=-%mem | head


➡️ Lists top processes consuming memory.


Conclusion

The combination of free, vmstat, and ps helps you track and troubleshoot memory usage effectively.

Comments