How to check the memory usage of all processes in Linux?

You can use the following command in the Linux system to check the memory usage of all processes:

  1. To sort and display all processes by memory usage, enter the “top” command in the terminal and press “Shift + M”.
  2. ps command: In the terminal, by entering the ps command with the “-eo pid,ppid,cmd,%mem –sort=-%mem” parameters, you can list all processes’ pid, ppid, command, and memory usage percentage in descending order of memory usage.

Example of command:

ps -eo pid,ppid,cmd,%mem --sort=-%mem
  1. To use the htop command, simply install it using a package manager if it’s not already on the system. Run the command in the terminal and press “F6” to select “%MEM” for sorting processes by memory usage and displaying their information.

All of these commands can display the memory usage of all current processes, so you can choose one to use as needed.

bannerAds