Review your favorite Linux distribution.
Go Back > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.


  Search this Thread
Old 05-13-2015, 05:56 AM   #1
Registered: Oct 2013
Posts: 90

Rep: Reputation: Disabled
Capturing output of top command

We have RHEL 5.11 in our production environment. I had some confirmation and some observation with capturing output of top command.

1) To capture top output,

top n 3 b > top.lst

should be fine?

2) I had observation that top command output can be very long which may not be evident if we give top at prompt and do Ctrl+C. This was an observation that the top command at prompt could be displaying only 1 screen at a time whereas the complete output of top command can be 3 page scrolls.

I hope, I have been able to explain my query and observation with regard to capturing output of top command.

Requesting a reply to my query.

Old 05-13-2015, 05:59 AM   #2
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,146

Rep: Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935Reputation: 2935
1 members found this post helpful.
Old 05-15-2015, 08:58 PM   #3
Registered: Mar 2015
Distribution: Linux Mint
Posts: 604

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
The command will do three iternations of the top command and be formatted for being send to a text file.

       -b  :Batch-mode operation
            Starts top in 'Batch' mode, which could be useful for sending
            output  from  top  to  other  programs or to a file.  In this
            mode, top will not accept input and runs until the iterations
            limit  you've  set with the '-n' command-line option or until
       -n  :Number-of-iterations limit as:  -n number
            Specifies the maximum number of iterations,  or  frames,  top
            should produce before ending.
If that is what you want, then it is fine. It will be long because it is all output three times. If you want just one iteration, perhaps change -n to 1?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] capturing output of command in vim editor sumeet inani Linux - Newbie 11 03-22-2011 02:01 AM
Capturing Output from net ads dns register Command jfmorales Linux - General 2 04-07-2010 03:07 PM
Capturing output from background FTP command Lazypete Linux - Server 6 05-22-2008 10:41 AM
Perl: Running Command line apps in background and capturing output s0l1dsnak3123 Programming 8 03-28-2008 01:24 PM
expect_out(buffer) is not capturing all output from a Cisco IOS command eentonig Programming 1 01-30-2008 07:29 AM > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 06:54 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration