Id like to measure the cpu usage during the execution of a command. If I type $ cp BigFile Location
Id like to see how much this process used cpu power
Asked
Active
Viewed 517 times
2

René
- 358
- 1
- 10
-
`time cp Location`, will give you processing time, what metric are you after? – Lawrence Cherone Jun 30 '20 at 11:34
-
@LawrenceCherone but i need the cpu usage in percent – René Jun 30 '20 at 11:35
-
1You might be interested in this post: https://unix.stackexchange.com/questions/554/how-to-monitor-cpu-memory-usage-of-a-single-process – kvantour Jun 30 '20 at 11:36
-
percent is a rolling average :/ if it takes 20mins how would 15% make sense, some details on conversion from time to utilisation [here](https://stackoverflow.com/questions/28240978/how-to-interpret-cpu-time-vs-cpu-percentage) – Lawrence Cherone Jun 30 '20 at 11:36
-
I need a min and average and a high value – René Jun 30 '20 at 11:38
-
I need a tool which does the same thing as time but for cpu usage – René Jun 30 '20 at 11:54
3 Answers
2
I recently found a tool which measures time, cpu usage, memory usage all at once. Its called /usr/bin/time
and should be installed via apt

René
- 358
- 1
- 10
1
htop
is a graphical solution in the shell - maybe this one helps
There you can search for it.

user12372096
- 46
- 3
0
top
command will show you memory and CPU usage,
you can pipe with grep
top | grep chrome # for google chrome cpu and mem usage for and example

Hutch
- 167
- 2
- 8
-
that works but how do i check the usage from a command within a script and store it into a file or smth – René Jun 30 '20 at 11:37
-
-
-
1how about giving approximate time loop : https://stackoverflow.com/questions/11176284/time-condition-loop-in-shell – Hutch Jun 30 '20 at 11:45
-
-
-
this might help https://unix.stackexchange.com/questions/321440/how-can-i-check-to-see-if-a-process-is-stopped-from-the-command-line – Hutch Jun 30 '20 at 12:16