Junior — Middle
How can you determine the process's RAM usage in Linux?
sobes.tech AI
Answer from AI
In Linux, there are several ways to determine the memory usage of a process:
- The
pscommand — shows information about processes, including memory usage:
ps aux | grep <process_name>
The RSS (Resident Set Size) column shows the amount of physical memory used in kilobytes.
-
The
toporhtopcommands — interactive utilities for monitoring processes and their resource consumption, including memory. -
The
/proc/[pid]/statusor/proc/[pid]/statmfiles — contain detailed information about a specific process's memory. For example:
cat /proc/<pid>/status | grep VmRSS
shows the current amount of physical memory used.
- The
pmapcommand — displays the memory map of a process:
pmap <pid>
- Utilities like
smemorpidstat— for more detailed memory usage analysis.
These methods allow obtaining both overall and detailed views of a process's memory usage.