Check Linux Memory Usage by Process

The following command can be used in the Linux system to check who is occupying the memory:

  1. To sort the process list by memory usage and see which process is using memory, enter the “top” command in the terminal and press the M key.
  2. htop command: If htop is not installed on the system, you can install it by using the following command:
  3. Install htop using the sudo apt install command on Ubuntu/Debian system.
  4. After installing on CentOS/RHEL system, type “htop” in the terminal, press F6, select MEM% to display the process list sorted by memory usage.
  5. ps command: By typing ps aux –sort=-%mem in the terminal, you can display a list of all processes sorted by memory usage from highest to lowest.
  6. pmap command: Inputting pmap -x in the terminal allows you to view the memory information of a specific process.
  7. To check the usage and available memory on the system, type the command “free -m” in the terminal.
  8. The /proc/meminfo file provides detailed information about the system’s memory, including the amount of memory that is currently in use, and can be viewed using the command cat /proc/meminfo.

These are several commonly used methods, you can choose the appropriate way to check who is occupying the memory based on the actual situation.

bannerAds