Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 627  / 2 Years ago, sat, november 5, 2022, 1:13:31

I've typed this command to get the memory usage for each user :



ps aux | awk 'NR>2{arr[$1]+=$6}END{for(i in arr) print i,arr[i]}'


I want to know if there is a command or a way to get the cpu usage or in other words "cpu utilization percentage" for each user like the above command which its output :



enter image description here


More From » 12.04

 Answers
4

I might be wrong, but isn't it just this ?



ps aux | awk 'NR>2{arr[$1]+=$3}END{for(i in arr) print i,arr[i]}'


The response is in % of CPU usage.


[#26981] Saturday, November 5, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
issfullus

Total Points: 264
Total Questions: 126
Total Answers: 107

Location: Comoros
Member since Mon, Dec 19, 2022
1 Year ago
;