How to check the memory usage in a shell?
To check the memory usage, you can utilize the following command:
- Free: Display the usage of system memory, including total memory, used memory, free memory, and usage of buffer/cache memory.
- Top: Real-time display of resource utilization of each process in the system, including memory, CPU usage, etc.
- htop is similar to top, but it offers more interactive features like sorting and searching.
- vmstat: provides statistics on virtual memory, including memory, disk, CPU, and more.
- The command “cat /proc/meminfo” displays detailed information about the system’s memory, including values for various memory metrics.
Using these commands can help you understand the system’s memory usage, enabling you to promptly identify and address any memory-related issues.