How to find out total memory resource usage with ps?

You could sum the usage columns with awk:

ps --no-headers -u $USER -o pcpu,rss | awk '{cpu += $1; rss += $2} END {print cpu, rss}'

You might also be interested in the free command for memory usage:

$ free
             total       used       free     shared    buffers     cached
Mem:       2055480    1806596     248884          0      14016     346276
-/+ buffers/cache:    1446304     609176
Swap:      2097148     132980    1964168

The output is in kilobytes (use free --mega for megabytes or free -m for mebibytes). In particular, the used, +/- buffers/cache entry is something like the total physical memory used (by everyone).

Tags:

Memory

Ps