sudo cat /proc/1/smaps | grep '^Pss:' | tr -s ' ' | cut -d' ' -f2 | paste -sd+
sudo cat /proc/1/smaps: print the content of
smapsof process 1. Running it with
sudo, because regular users don't have access to such level of process memory accounting details.
| grep '^Pss:': filter the output, keeping only lines that start with "Pss:"
| tr -s ' ': squeeze the output, by replacing repeated spaces with a single space
| cut -d' ' -f2: extract the second field from the output, using space as the delimiter
| paste -sd+: paste all the lines together, delimited by "+"
1 with the PID of a command for which you want to see the Proportional Set Size value.
See more information about Linux memory accounting at: https://www.kernel.org/doc/html/latest/filesystems/proc.html
Only works in Linux.