user559096
user559096

Reputation: 107

Bash Script for calculate the memory of a application

I want a bash script which will calculate the amount of memory used by specific application or command.

Upvotes: 2

Views: 360

Answers (2)

Dennis Williamson
Dennis Williamson

Reputation: 360095

ps o rss= -p PID will output the resident set size of the given process.

Use size instead of rss to get the code+data+stack size.

Upvotes: 2

MJVDM
MJVDM

Reputation: 3963

possible way:

use top within terminal, then pipe the output into a file and get the line you need (grep)

Upvotes: 1

Related Questions