In Linux, you can find out memory utilization using various commands. Here are a few commonly used commands:
free
The free command provides information about total, used, and free memory in kilobytes. Open a terminal and type:
free -m
This will display the memory usage in megabytes.
top
The top command is an interactive process viewer that provides real-time information about system resources, including memory utilization. Open a terminal and type:
top
Look for the memory-related information at the top of the screen. Press 'q' to exit top.
htop
Similar to top, but with a more user-friendly interface, htop provides real-time information about system resources, including memory usage. If it's not installed, you can install it using your package manager (e.g., sudo apt-get install htop on Debian/Ubuntu). Once installed, run:
htop
Navigate using arrow keys, and press 'q' to exit.
vmstat
The vmstat command reports information about processes, memory, paging, block IO, traps, and CPU activity. Open a terminal and type:
vmstat -s
This will display a summary of memory statistics.
/proc/meminfo:
The /proc/meminfo file contains detailed information about the system's memory usage. You can view its contents using commands like cat or grep. For example:
cat /proc/meminfo
or
grep MemTotal /proc/meminfo
The output of these commands will show you information about total, used, free, and cached memory, as well as other memory-related details. Keep in mind that the units may be displayed in kilobytes (KB) or megabytes (MB) depending on the command used.
Just a simple blog to share my thought, idea, opinion, note, and documentation about computer and information technology
Friday, December 08, 2023
How do I find out memory utilization in Linux?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment