linux - How do you extract only the CPU usage and the process names columns from top command? -


i want extract cpu usage column percentages , process names output of top command. redirecting output file , using that. output need below.

%cpu  command 6.2   xorg 6.2   gnome-terminal 6.2   top 0.0   init 0.0   kthreadd 0.0   ksoftirqd/0 0.0   kworker/0:0h 0.0   kworker/u:0h 0.0   migration/0 0.0   rcu_bh 

from command line or within top?

if you're in top, press f , toggle columns want see.

alternatively, can use ps:

ps -eo %cpu,pid --sort -%cpu 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -