I'm a bit confused on some of the results I am seeing from "ps" and "free".
On my server, this is the result of "free -m"
[root@server ~]# free -m
total used free shared buffers cached
Mem: 2048 2033 14 0 73 1398
-/+ buffers/cache: 561 1486
Swap: 2047 11 2036
My understanding of how Linux manages memory, is that it will store disk usage in RAM, so that each subsequent access is quicker. I believe this is indicated by the "cached" columns. Additionally, various buffers are stored in RAM, indicated in the "buffers" column.
So if I understand correctly, the "actual" usage is supposed to be the "used" value of "-/+ buffers/cache", or 561 in this case.
So assuming all of that is correct, the part that throws me is the results of "ps aux".
My understanding of the "ps" results, is that the 6th column (RSS), represents the size in kilobytes the process uses for memory.
So when I run this command:
[root@server ~]# ps aux | awk '{sum+=$6} END {print sum / 1024}'
1475.52
Shouldn't the result be the "used" column of "-/+ buffers/cache" from "free -m"?
So, how can I properly determine the memory usage of a process in Linux? Apparently my logic is flawed.