2

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

2
  • Did you search for solutions? Did you check whether any existing tools solves your requirement? Post your efforts so far. Commented May 7, 2012 at 9:48
  • It's not clear why you need a whole bash script just for that.. You can use ps or top commands to find out that information.. Commented May 7, 2012 at 16:57

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

possible way:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.