4

Using these ps options I cut 10 lines and order output of ps by cpu usage (pcpu):

ps -eo pcpu,etime,pid,user,args --no-headers| sort -t. -nk1,2 -k4,4 -r |head -n 10

I need also show the name of columns (like same commands without cutting the output).

%CPU     ELAPSED   PID USER     COMMAND
 0.0 10-23:41:11     1 root     init [2]  
 0.0 10-23:41:11     2 root     [kthreadd]
8
ps -eo pcpu,etime,pid,user,args --sort=-%cpu | head -10
  • 3
    It should probably be head -11 if he wants the top 10 processes. – GregL Apr 1 '15 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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