Skip to main content
3 of 3
deleted 13 characters in body
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 238

How to use top in a shell script to track memory consumption of a process?

I was wondering if there was a way to use top or another program to track the memory consumption of a script I will be running. I was using

   runtime.totalMemory - runtime.freeMemory

But that's not cutting it, as it takes into consideration the whole system, not just the process I want to track.

I'm using a shell script to run a scala program which I want to have its memory usage tracked.