LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-11-2006, 09:56 AM   #1
DarkPenguin
LQ Newbie
 
Registered: Feb 2006
Posts: 4

Rep: Reputation: 0
'N' lines of Top Command?


Greetings, Gurus!!

I have been searching high and low for this, and have had no luck thus far....is there any way of just returning 'n' number of lines from TOP?

I have a script that calls the TOP command, as well as a couple of other commands, wraps their output to a file, and mails it out. However, lately, the mail hasn't been coming, since the output from TOP has been huge. Is there any way of telling the script to only show the top 'N' number of processes, so that I don't run into this again?

Thanks!
 
Old 04-11-2006, 10:00 AM   #2
Wells
Member
 
Registered: Nov 2004
Location: Florida, USA
Distribution: Debian, Redhat
Posts: 417

Rep: Reputation: 53
I am assuming that you are using top in the batch mode version, ie top -b -n 1 or something similar. I figure the best way to get N number of lines from this output would be to pipe it through the head command, something like this:

$ top -b -n 1 | head -n 4

This would give you the first four lines of the output of top.
 
Old 04-11-2006, 11:05 AM   #3
DarkPenguin
LQ Newbie
 
Registered: Feb 2006
Posts: 4

Original Poster
Rep: Reputation: 0
Yep, that was it. I should've seen that. D'oh!!!

Back to the books for me, then.....

Thanks!
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Command erase lines paraiso Linux - Newbie 4 05-12-2005 10:48 AM
Getting multi-colour lines from top to bottom djeanveau Fedora - Installation 3 01-30-2005 08:58 PM
Getting multi-colour lines from top to bottom djeanveau Linux - Newbie 1 01-30-2005 12:02 PM
Executing command lines in C/C++ ReverseLogic Programming 2 05-28-2002 02:08 PM
command lines? rockin chair Linux - General 5 04-28-2002 10:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:15 AM.

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