Install ps_mem on Raspberry Pi

The ps_mem is a command line tool that enables to check the RAM usage for a programs. This tool calculates the amount of RAM (private memory + shared memory) being used by each program. The ps_mem requires the Python interpreter.

This tutorial explains how to install ps_mem on Raspberry Pi.

Use SSH to connect to Raspberry Pi. Download ps_mem script from GitHub repository to the /usr/local/bin directory.

sudo wget -O /usr/local/bin/ps_mem https://raw.githubusercontent.com/pixelb/ps_mem/master/ps_mem.py

Then add execute permission to the script:

sudo chmod a+x /usr/local/bin/ps_mem

Now ps_mem is available for all users as a system-wide command. We can check version of ps_mem:

ps_mem --version

Execute the ps_mem command without any arguments to get memory usage of each program.

sudo ps_mem

A part of the output of a command:

 Private  +   Shared  =  RAM used       Program

172.0 KiB +  43.5 KiB = 215.5 KiB       rngd
208.0 KiB + 143.5 KiB = 351.5 KiB       thd
232.0 KiB + 142.5 KiB = 374.5 KiB       cron
.......
  1.2 MiB +   3.4 MiB =   4.6 MiB       sshd (3)
  3.2 MiB +   3.5 MiB =   6.6 MiB       systemd (3)
 11.2 MiB +   1.0 MiB =  12.2 MiB       unattended-upgr
---------------------------------
                         52.6 MiB
=================================

A list is sorted by RAM usage from the smallest to the largest.

If ps_mem is no longer necessary, just delete the script with command:

sudo rm -rf /usr/local/bin/ps_mem

Leave a Comment

Your email address will not be published. Required fields are marked *