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]
1 Answers