Operating System - HP-UX
1825795 Members
2261 Online
109687 Solutions
New Discussion

Redirecting output of "top" to a file

 
SOLVED
Go to solution
Shivkumar
Super Advisor

Redirecting output of "top" to a file

Dear Sirs,

How to redirect the output of "top" command to a file ?

Actually i tried with the command top > test1
but the output was not in a readable format.

Thanks,
Shiv
5 REPLIES 5
Ranjith_5
Honored Contributor

Re: Redirecting output of "top" to a file

Hi Shiva,

Use top with -f option to collect the out put in a file. See the below link.

http://docs.hp.com/en/B2355-60105/top.1.html


Regards,
Syam
Ranjith_5
Honored Contributor
Solution

Re: Redirecting output of "top" to a file

Shiva,

you can combine -d and -f options to get a continuous output in a file.

syntax:-

#top -d 5 -f /tmp/top.out


The above command will give you 5 outputs of the top command.

Go through man page for a complete list of flags which can be used with top command.

Regards,
Syam
Devender Khatana
Honored Contributor

Re: Redirecting output of "top" to a file

Hi Shiv,

-f option will do this for you. There are many other parameters as well.

Man top for details.

#man -f topoutput

Will create topoutput file in current directry for the entries in first page.

HTH,
Devender
Impossible itself mentions "I m possible"
Arunvijai_4
Honored Contributor

Re: Redirecting output of "top" to a file

You can use # top -f

-f filename Output is appended to filename. When -f is used, top defaults to 1 for -d and 16 for -n.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Yogeeraj_1
Honored Contributor

Re: Redirecting output of "top" to a file

hi Shiv,

we usually use:
top -s5 -d6 -f top.out

that will capture the data for 30 seconds for every 5 seconds.


also, we recently started using "extract" - measureware utility that enabled use to collect much more information and plot great performance graphs.

if you need any further assistance, do let us know.


kind regards
yogeeraj

No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)