How to check the memory usage of processes on Linux?

You can use the following command in a Linux system to view the memory usage of processes:

  1. The top command allows real-time monitoring of the system’s status, including the memory usage of processes. Pressing “Shift + M” after entering the top command in the terminal sorts processes by memory usage.
  2. The ps command can display information about processes in the current system. By combining different options with the ps command, you can view the memory usage of processes. For example, using the following command can show information such as the PID (Process ID), RSS (Resident Set Size), and VSZ (Virtual Memory Size) of processes.
  3. List process IDs, resident set size (in KB), virtual memory size (in KB), and command for all processes.
  4. The pmap command displays the memory mapping of a process, including the size and permissions of each memory region. It provides a detailed insight into the memory usage of a process. For example, using the following command allows you to view the memory mapping of a specified process:
  5. Show me a map of the specified process ID.
  6. smem command: Displays statistical information about the memory usage of processes in the system. It allows you to view the actual physical memory usage of processes. For example, using the following command will display statistical information about the memory usage of all processes:
  7. reboot the system

These are some commonly used methods, you can choose the appropriate command based on your specific needs to view the memory usage of processes.

bannerAds