0

I am trying to get the current (not the average) free memory size of SUN SPARC remote server, but I don't have the permission to use free -m command or prtconf. So, I used command vmstat 2 and the result is kthr memory page disk faults cpu

r b w   swap  free  re  mf pi po fr de sr vc vc vc vc   in   sy   cs us sy id

0 0 0 46981864 20824288 311 416 51 1 1 0 0 27 6  0 18 16070 33290 17580 12 2 87

0 0 0 45534984 9138264 127 405 0 0 0 0  0  0  0  0 32 17427 45040 20877 25 2 73

0 0 0 45534984 9138072 208 510 0 0 0 0  0  7  0  0  0 14544 35758 17416 23 2 75

0 0 0 45534984 9138072 96 324 0 0 0  0  0  0  0  0 63 6443 11683 5701 11 1 89

and vmstat| awk '{print $5}' and the result is 20824288 which is the average not the current value ,so how to get the actual value ?

2 Answers 2

0

You can use command like:

vmstat 1 3|tail -1 |awk '{print $5}'

The idea is to exec vmstat 3 times (the first execution get average values from the start of the system), get last line and extract free memory value.

0

I suggest to use top's output:

top | awk '/free mem$/{print $5}'

Output (example):

3201M

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .