I typed the free command to get the memory usage as follows :
free -m
output:
I want to use this command to get the same info but for all users for example :
I used this command .. because it easy for me .. to store its output in a variables in a bash scrip …
Best Answer
free
is already based on the system-wide memory usage.If you want something on a per-user basis, you could try something like:
As a quick explanation of what the
awk
does:ps aux
(resident set size) and adds them up.