0

uptime piped to sed fixes the first part but what about memory usage? top runs, at least by default, interactively.

So: I need to watch used RAM excluding opportunistic caching(which gets dropped as soon as the memory is needed). And ask about both because I expect a single standard tool can do it, instead of two. Or - even better - something in /proc indicating the RAM part.

Vorac
  • 3,077

2 Answers2

1

Try free tool or cat /proc/meminfo - they would give you memory state at this very moment.

White Owl
  • 5,129
1

What you can use is vmstat. This tool will give you the CPU usage and memory consumption. Be aware the first row is average usage from the moment machine start so you should search for next lines.

Romeo Ninov
  • 17,484
  • +1 Ended up using free but thank You for teaching me this standard utility. Also Your post answers the question body better but ... life. – Vorac Jan 09 '23 at 15:27
  • 1
    @Vorac, you ask for one utility to check CPU and memory. But it is your decision... – Romeo Ninov Jan 09 '23 at 15:37
  • Indeed Your answer is the best. Accepted the other only because SE 'accept' means 'how was the problem solved'. Upvotes will take care of any confusion :) – Vorac Jan 09 '23 at 15:59