0

I am running an OpenSSL script. How to get % cpu and % memory? Normally I am using top command in other terminal. top is returning % CPU and % memory but for noting down it is taking time. Is there any alternative?

0
1

You can use time command for this purpose too :)

command time -f "\nElapsed: %E \nUser: %U \nSystem: %S \nMemory: %M\n" [your command/script here] 1> /dev/null

with top you can do something like:

top -p [pid of your process] -b > log

e.g:

top -p `pidof openssl` -b > log
4
  • Note that this would be the external time command and not the builtin time keyword, so you have to use the path or the command keyword
    – muru
    May 9 '17 at 6:48
  • @muru actually it was defined with full path, but your comment made me interesting to see what is going on. After reading this I learned something new ;) thanks again :)
    – Ravexina
    May 9 '17 at 7:54
  • so what should I use
    – prasanna
    May 9 '17 at 9:07
  • @prasanna The command in answer will work for you ;)
    – Ravexina
    May 9 '17 at 9:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.