Tom Smith
Tom Smith

Reputation: 341

Is there a way to measure how much a shell command used memory?

Is there a way to measure how much an executed terminal command/operation used memory, like the built-in command time for measuring execution time. I'd like to compare commands with different parameters.

Upvotes: 6

Views: 1951

Answers (2)

Tom Smith
Tom Smith

Reputation: 341

I was looking for something like this.

This is how I used it:

$/usr/bin/time -f "%E %M" *<command>*

That gave me:
time (%E) - elapsed real time (in [hours:]minutes:seconds);
memory (%M) - maximum resident set size of the process during its lifetime, in kB.

Upvotes: 13

Akos
Akos

Reputation: 59

With top or htop you can view memory usage for all processes, not only for one.

Upvotes: 3

Related Questions