On 27-Jul-04 Iain Roberts wrote:
Thus may double-count shared libraries, but you could try
ps aux|grep -v MEM|awk '{total += $4 }; END { print total}'
which will add up the total %age memory used by each process.
... which very nicely gives:
$ free total used free shared buffers cached Mem: 126024 120792 5232 0 1580 52824 -/+ buffers/cache: 66388 59636 Swap: 400640 133808 266832
$ ps aux|grep -v MEM|awk '{total += $4 }; END { print total}' 59.4
which presumably suggests I should have about 60MB to play with.
Glad to encounter another 'awk' fan! Thanks for the tip about $4 in 'ps': I'd been expecting to find it somewhere there if I only knew just how to look.
To see if you really have a memory problem (i.e. has the system really run out of memory) you need to look at swapping rather than memory usage : vmstat 2 will show you : look for non-zero numbers on si and so.
And thanks for this tip too. Best wishes, Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@nessie.mcc.ac.uk Fax-to-email: +44 (0)870 167 1972 Date: 28-Jul-04 Time: 08:11:12 ------------------------------ XFMail ------------------------------