Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

redirect "top" to file problem?

 
SOLVED
Go to solution
Highlighted
huaxiang
Frequent Advisor

redirect "top" to file problem?



1.#top -d 1 >>/tmp/toptest
2. cat /tmp/toptest:

huatest
^[[0m^[[2J^[[HSystem: dlsdb^[[41CFri Nov 7 16:36:15 2008^[[BLoad averages: 0.02, 0.02, 0.02^[[B377 proce
sses: 325 sleeping, 52 running^[[BCpu states:^[[BCPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SS
YS^[[B 0 0.01 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%^[[B 1 0.01 0.0% 0.0% 0.0% 100.0
% 0.0% 0.0% 0.0% 0.0%^[[B 2 0.01 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%^[[B 3 0.01
0.0% 0.0% 1.0% 99.0% 0.0% 0.0% 0.0% 0.0%^[[B 4 0.03 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0%
0.0%^[[B 5 0.01 0.0% 0.0% 1.0% 99.0% 0.0% 0.0% 0.0% 0.0%^[[B 6 0.01 0.0% 0.0% 0.0%
100.0% 0.0% 0.0% 0.0% 0.0%^[[B 7 0.01 1.0% 0.0% 0.0% 99.0% 0.0% 0.0% 0.0% 0.0%^[[B 8
0.01 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%^[[B 9 0.01 0.0% 0.0% 1.0% 99.0% 0.0% 0.0%
0.0% 0.0%^[[B10 0.02 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%^[[B11 0.02 0.0% 0.0%
1.0% 99.0% 0.0% 0.0% 0.0% 0.0%^[[B12 0.03 0.0% 0.0% 1.0% 99.0% 0.0% 0.0% 0.0% 0.0%^[[B
13 0.04 0.0% 0.0% 1.0% 99.0% 0.0% 0.0% 0.0% 0.0%^[[B14 0.04 0.0% 0.0% 1.0% 99.0% 0.0% 0
.0% 0.0% 0.0%^[[B15 0.04 0.0% 0.0% 1.0% 99.0% 0.0% 0.0% 0.0% 0.0%^[[B--- ---- ----- ---
-- ----- ----- ----- ----- ----- -----^[[Bavg 0.02 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%^[[
2BSystem Page Size: 4Kbytes^[[BMemory: 6006508K (2348900K) real, 6830220K (2976828K) virtual, 42243832K free Page#
1/19^[[2BCPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND^[[B 6 ? 196 root 1
91 20 48888K 43456K run 896:02 5.06 5.05 vxfsd^[[B 5 ? 200 root 191 20 9216K 8192K run^[[6C3:51 2.50
2.50 pagezerod^[[B 0 ? 2589 oracle 152 20 608M 214M run 16:15 1.06 1.06 java^[[B 7 ? 198 root
191 20 1224K 1088K run 20:50 0.44 0.44 pm_schedcpu^[[B 6 ? 2072 root -16 20 637M 525M run 27
1:10 0.33 0.33 midaemon^[[B 5 ? 8 root 191 20 2016K 1792K run^[[6C1:10 0.33 0.33 ksyncer_daemon
^[[B14 ? 1850 root 152 20 195M 75760K run^[[6C5:33 0.33 0.33 cimprovagt^[[B12 ? 187 root 191 20
9216K 8192K run^[[6C0:16 0.31 0.31 fb_daemon^[[B 1 ? 3009 oracle 152 20 105M 31108K run 17:06 0.21 0
.21 emagent^[[B 7 ? 1644 root 154 20 10872K 1288K sleep 39:02 0.21 0.21 sendmail:^[[B12 ? 1848 cim
srvr 152 20 57332K 14432K run 37:05 0.19 0.19 cimservermain^[[B13 ? 12378 root 152 20 180M 24840K run
^[[6C4:11 0.18 0.18 nbrmms^[[B 6 ? 1842 root 152 20 25852K 5592K run^[[6C0:17 0.14 0.14 rpcd^[[B1
4 ? 2318 root 152 20 87552K 15228K run^[[6C1:05 0.14 0.14 vxsvc^[[B11 ? 19936 root 152 20 44320K 3556
K run^[[6C0:01 0.12 0.12 cimprovagt^[[B 5 ? 2084 root 152 20 50748K 7736K run^[[6C2:03 0.12 0.12 ovcd
^[[B15 ? 2093 root 152 20 26020K 4700K run^[[6C0:21 0.12 0.12 swagentd^[[B 5 ? 2213 root 152 2
0 121M 11428K run^[[6C0:28 0.12 0.12 coda^[[B 4 ? 3029 oracle 154 20 8682M 8940K sleep 2:12 0.12 0.12
oraclenmdls^[[44C ^[[0K^[[123C^[[0m^[[2J^[[HSystem: dlsdb^[[41CFri Nov 7 16:36:49 2008^[[BLoad
averages: 0.02, 0.02, 0.02^[[B375 processes: 323 sleeping, 52 running^[[BCpu states:^[[BCPU LOAD USER
NICE SYS IDLE BLOCK SWAIT INTR SSYS^[[B 0 0.01 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%
^[[B 1 0.01 14.9% 0.0% 5.9% 79.2% 0.0% 0.0% 0.0% 0.0%^[[B 2 0.02 1.0% 0.0% 1.0% 98.0%
0.0% 0.0% 0.0% 0.0%^[[B 3 0.01 4.0% 0.0% 4.0% 92.1% 0.0% 0.0% 0.0% 0.0%^[[B 4 0.02
0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%^[[B 5 0.01 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0%
0.0%^[[B 6 0.01 0.0% 0.0% 3.0% 97.0% 0.0% 0.0% 0.0% 0.0%^[[B 7 0.01 0.0% 0.0% 1.0% 9
9.0% 0.0% 0.0% 0.0% 0.0%^[[B 8 0.01 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%^[[B 9 0
.01 0.0% 0.0% 0.0% 100.0% 0.0% 0.0% 0.0% 0.0%^[[B10 0.02 0.0% 0.0% 1.0% 99.0% 0.0% 0.0% 0
.0% 0.0%^[[B11 0.02 0.0% 0.0% 1.0% 99.0% 0.0% 0.0% 0.0% 0.0%^[[B12 0.03 0.0% 0.0% 1.
0% 99.0% 0.0% 0.0% 0.0% 0.0%^[[B13 0.04 0.0% 0.0% 1.0% 99.0% 0.0% 0.0% 0.0% 0.0%^[[B14
0.04 0.0% 0.0% 1.0% 99.0% 0.0% 0.0% 0.0% 0.0%^[[B15 0.04 0.0% 0.0% 1.0% 99.0% 0.0% 0.0
% 0.0% 0.0%^[[B--- ---- ----- ----- ----- ----- ----- ----- ----- -----^[[Bavg 0.02 1.0% 0.0%
1.0% 98.0% 0.0% 0.0% 0.0% 0.0%^[[2BSystem Page Size: 4Kbytes^[[BMemory: 6016568K (3208668K) real, 684
3412K (3855892K) virtual, 42246192K free Page# 1/19^[[2BCPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU
%CPU COMMAND^[[B 6 ? 196 root 191 20 48888K 43456K run 896:03 5.34 5.33 vxfsd^[[B 5 ? 200 root
191 20 9216K 8192K run^[[6C3:51 2.50 2.50 pagezerod^[[B 0 ? 2589 oracle 152 20 608M 214M run 16
:16 1.17 1.17 java^[[B 7 ? 198 root 191 20 1224K 1088K run 20:50 0.42 0.42 pm_schedcpu^[[B 5
? 8 root 191 20 2016K 1792K run^[[6C1:10 0.33 0.33 ksyncer_daemon^[[B14 ? 1850 root 152 20 195M
75760K run^[[6C5:33 0.33 0.33 cimprovagt^[[B12 ? 187 root 191 20 9216K 8192K run^[[6C0:16 0.31 0.31 f
b_daemon^[[B 4 ? 2072 root -16 20 637M 525M run 271:10 0.31 0.30 midaemon^[[B14 ? 1848 cimsrvr
152 20 57332K 14432K run 37:05 0.26 0.26 cimservermain^[[B 4 ? 24726 oracle 154 20 8678M 7484K sleep 0
:00 0.66 0.24 ora_j000_nmdls^[[B 1 ? 3009 oracle 152 20 105M 31240K run 17:06 0.22 0.22 emagent^[[B
9 ? 1852 root 152 20 38744K 2828K run 38:38 0.19 0.19 cimprovagt^[[B 7 ? 1644 root 154 20 108
72K 1288K sleep 39:02 0.17 0.17 sendmail:^[[B13 ? 12378 root 152 20 180M 24840K run^[[6C4:11 0.17 0.17
nbrmms^[[B 6 ? 5272 root -27 20 41428K 32628K run^[[6C3:56 0.15 0.15 cmcld^[[B 6 ? 1842 root 1
52 20 25852K 5592K run^[[6C0:17 0.14 0.14 rpcd^[[B14 ? 2318 root 152 20 87552K 15228K run^[[6C1:05 0.14
0.14 vxsvc^[[B 5 ? 2084 root 152 20 50748K 7736K run^[[6C2:03 0.13 0.13 ovcd^[[B 6 ? 2616 oracle
154 20 8692M 18380K sleep 2:46 0.12 0.12 oraclenmdls^[[44C ^[[0K^[[123C


3. how to make the log file readable?
4 REPLIES 4
Highlighted
Ganesan R
Honored Contributor
Solution

Re: redirect "top" to file problem?

Hi,

Correct syntax would be,

#top -d 1 -f /tmp/toptest

then

#more /tmp/toptest

Best wishes,

Ganesh.
Highlighted
Ganesan R
Honored Contributor

Re: redirect "top" to file problem?

Hi,

If you want append the output with existing file, no need to give >> option.

-f option will just append if the file is already exist.

#top -d 1 -f /tmp/toptest --> It just will append the output if /tmp/toptest exist.

Best wishes,

Ganesh.
Highlighted
Suraj K Sankari
Honored Contributor

Re: redirect "top" to file problem?

Hi,
See the below output

$ top -f /tmp/tmp1.out

$ cat /tmp/tmp1.out
System: testbox Fri Nov 7 15:09:25 2008
Load averages: 0.35, 0.36, 0.36
307 processes: 267 sleeping, 39 running, 1 zombie
Cpu states:
CPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS
0 0.25 14.2% 0.0% 1.8% 84.0% 0.0% 0.0% 0.0% 0.0%
1 0.31 23.2% 0.0% 2.8% 74.1% 0.0% 0.0% 0.0% 0.0%
2 0.34 8.2% 0.0% 5.2% 86.6% 0.0% 0.0% 0.0% 0.0%
3 0.50 50.1% 0.0% 2.8% 47.1% 0.0% 0.0% 0.0% 0.0%
--- ---- ----- ----- ----- ----- ----- ----- ----- -----
avg 0.35 24.0% 0.0% 3.2% 72.8% 0.0% 0.0% 0.0% 0.0%

Memory: 8630920K (2756696K) real, 17078960K (4771832K) virtual, 4699560K free Page# 1/20

CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND
3 ? 17629 pd1adm 229 20 10530M 570M run 142:35 83.91 83.77 dw.sapPD1_DVEBMGS00
0 ? 17631 orapd1 154 20 3977M 4628K sleep 114:05 11.44 11.42 oraclePD1
0 ? 50 root 152 20 1856K 1856K run 154:07 0.74 0.74 vxfsd
3 ? 4677 root 154 20 5572K 572K sleep 19:51 0.52 0.52 dm_TL_adapter
0 ? 15257 pd1adm 155 20 10050M 79828K sleep 4:17 0.43 0.43 dw.sapPD1_DVEBMGS00
1 ? 291 orapd1 156 20 3895M 17796K sleep 7:28 0.41 0.41 ora_lgwr_PD1
1 ? 6876 root 152 20 8720K 792K run 0:00 0.46 0.37 sshd:
2 ? 2309 pd1adm 168 20 12480K 2304K sleep 178:06 0.34 0.34 saposcol
2 ? 1778 root 152 20 40768K 5376K run 83:55 0.34 0.34 cimserver
0 ? 1785 root 152 20 42600K 4400K run 6:35 0.33 0.33 cimprovagt
0 ? 18101 pd1adm 155 20 10018M 59136K sleep 3:32 0.33 0.33 dw.sapPD1_DVEBMGS00
1 pts/0 25664 monitor 168 20 8172K 1516K sleep 0:27 0.27 0.27 top
0 ? 14314 orapd1 154 20 21100K 2792K sleep 18:54 0.27 0.27 tnslsnr
0 ? 460 pd1adm 152 20 478M 80500K run 0:04 0.23 0.23 icman
1 ? 1781 root 152 20 76096K 3024K run 21:00 0.22 0.21 cimprovagt
1 ? 21510 root 152 20 48320K 11892K run 13:25 0.20 0.20 ecoagt
$


Suraj
Highlighted
huaxiang
Frequent Advisor

Re: redirect "top" to file problem?

question solved ,thank u all.