When using top, you normally get something like this:
How can make only visible the percentage CPU output of one single process?
Currently I'm using this to output only one process:
Then I get this:
In the end I would like to see only '0.00%' for each line, so when I redirect this to a file, I end up with one column, which makes it easy to load in GNU Octave. I tried also with 'sed', but still with little success. Any suggestions?
Code:
last pid: 51918; load averages: 0.00, 0.00, 0.00 up 0+02:39:09 17:32:37
35 processes: 1 running, 34 sleeping
CPU 0: 0.0% user, 0.0% nice, 0.4% system, 0.0% interrupt, 99.6% idle
CPU 1: 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle
Mem: 30M Active, 206M Inact, 152M Wired, 360K Cache, 111M Buf, 590M Free
Swap: 2009M Total, 2009M Free
PID UID THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND
1013 1001 1 44 0 8304K 2268K CPU0 0 0:10 0.00% top
819 0 1 44 0 5864K 1272K select 0 0:08 0.00% powerd
986 1001 1 44 0 37040K 5168K select 1 0:02 0.00% sshd
51851 1001 1 76 0 139M 28988K ttyin 1 0:01 0.00% octave-3.2.3
994 1001 1 44 0 37040K 5172K select 0 0:00 0.00% sshd
1002 1001 1 44 0 37040K 5172K select 1 0:00 0.00% sshd
995 1001 1 44 0 10288K 2792K pause 0 0:00 0.00% csh
51876 0 1 48 0 37040K 5132K sbwait 0 0:00 0.00% sshd
999 0 1 49 0 37040K 5108K sbwait 0 0:00 0.00% sshd
991 0 1 48 0 37040K 5108K sbwait 0 0:00 0.00% sshd
1003 1001 1 44 0 10288K 2824K ttyin 0 0:00 0.00% csh
983 0 1 47 0 37040K 5080K sbwait 1 0:00 0.00% sshd
860 0 1 44 0 6920K 1600K nanslp 0 0:00 0.00% cron
618 0 1 44 0 5992K 1528K select 0 0:00 0.00% syslogd
987 1001 1 44 0 10288K 2704K pause 0 0:00 0.00% csh
51880 1001 1 44 0 10288K 2760K pause 0 0:00 0.00% csh
51879 1001 1 44 0 37040K 5196K select 1 0:00 0.00% sshd
51914 1001 1 44 0 6100K 1672K ttyin 0 0:00 0.00% more
51912 1001 1 47 0 7232K 1728K wait 0 0:00 0.00% sh
851 0 1 44 0 25108K 4156K select 0 0:00 0.00% sshd
51911 1001 1 45 0 5884K 1344K wait 1 0:00 0.00% man
51913 1001 1 45 0 6968K 1180K pipdwt 1 0:00 0.00% zcat
499 0 1 44 0 2180K 652K select 1 0:00 0.00% devd
935 0 1 76 0 4776K 1504K select 1 0:00 0.00% dhclient
907 0 1 76 0 5860K 1276K ttyin 1 0:00 0.00% getty
909 0 1 76 0 5860K 1276K ttyin 1 0:00 0.00% getty
913 0 1 76 0 5860K 1276K ttyin 0 0:00 0.00% getty
908 0 1 76 0 5860K 1276K ttyin 0 0:00 0.00% getty
912 0 1 76 0 5860K 1276K ttyin 0 0:00 0.00% getty
914 0 1 76 0 5860K 1276K ttyin 0 0:00 0.00% getty
910 0 1 76 0 5860K 1276K ttyin 1 0:00 0.00% getty
911 0 1 76 0 5860K 1276K ttyin 1 0:00 0.00% getty
147 0 1 76 0 2736K 1060K pause 1 0:00 0.00% adjkerntz
964 65 1 76 0 4776K 1648K select 1 0:00 0.00% dhclient
474 0 1 76 0 7012K 1368K select 1 0:00 0.00% moused
How can make only visible the percentage CPU output of one single process?
Currently I'm using this to output only one process:
Code:
top -U depaepe -b -d 2 | grep 51851
Then I get this:
Code:
51851 depaepe 1 76 0 139M 28988K ttyin 1 0:01 0.00% octave-3.2.3
51851 depaepe 1 76 0 139M 28988K ttyin 1 0:01 0.00% octave-3.2.3
In the end I would like to see only '0.00%' for each line, so when I redirect this to a file, I end up with one column, which makes it easy to load in GNU Octave. I tried also with 'sed', but still with little success. Any suggestions?