I have this situation with RAM and SWAP at the moment:

$ free -h
             total       used       free     shared    buffers     cached
Mem:          7,7G       7,5G       159M       100M        75M       5,9G
-/+ buffers/cache:       1,5G       6,1G
Swap:         7,9G       408M       7,5G

And I was wondering...

Is there a way to know what programs/data are RAM-cached and/or from which process do they come from?

Thank you very much in advance.

EDIT: to know the programs/data in SWAP follow the link provided by @xubu-tur .

  • I think if you run 'ps aux' and look at the column VSZ you'll find out. However there is no reason to worry about buffer or cache. This is performed by the OS itself and won't make your system run out of memory. Look here: askubuntu.com/questions/441928/… – Reza May 10 '14 at 10:02
  • I know what cache is and (more or less) how it works, it is just curiosity about the cached processes :) As I understood, ps axu shows the active processes, but not the dead and cached ones, nor the cached data relative to a non-existing process. – dadexix86 May 10 '14 at 10:21
  • Perhaps this stackoverflow.com/a/7180078 – TuKsn May 10 '14 at 10:32
  • This is really useful for the Swap indeed, thanks! – dadexix86 May 10 '14 at 11:03
  • 1
    Take a look at this very similar question: stackoverflow.com/questions/210809/… – bseibold May 15 '14 at 21:55

The same question was asked at LinuxQuestions.org: http://www.linuxquestions.org/questions/linux-general-1/command-to-check-process-taking-high-cached-memory-927756/

The important part of the answer is:

Cache isn't associated with a process per se, it is related to I/O on your system.

Linux tries to cache as much I/O data as it can. If that data needs to be read in the future, it is already in storage. Cache is a mechanism to avoid doing real I/O operations as real I/O to a disk is very slow compared to just retrieving it from memory. So a high cache number is generally good and nothing to be concerned with.

So, no you can't know which programs or processes are in cache, becasue there are no such items there.

What you can find there is cached I/O, and as @bseiblod mentioned in his comment, you can find a solution to that here: How can you tell whether a file is being cached in memory in linux?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.