LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-12-2011, 04:37 PM   #1
malickhat
Member
 
Registered: Jun 2009
Posts: 106

Rep: Reputation: 15
Top Command help


Hi All,
I just wanna to list the top 5 process in my "top command" i couldn't find any switch to do that ,and i don't want to use any additional command ,so any possible way in TOP command,please pass it to me
 
Old 10-12-2011, 04:49 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Oops ... you can :}

Press 'n', and then the number of processes.

Last edited by Tinkster; 10-12-2011 at 04:51 PM.
 
Old 10-12-2011, 04:50 PM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
In interactive mode press n then 5.
 
Old 10-12-2011, 04:56 PM   #4
malickhat
Member
 
Registered: Jun 2009
Posts: 106

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by colucix View Post
In interactive mode press n then 5.
Thanks , it helps but still i'm in interactive mode ,i want something like to display what's the first 5 process in my machine using top,again i need to get back to my prompt
 
Old 10-12-2011, 05:02 PM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
As previously noted by Tinkster above, there is no option to do that. You need to run top in batch mode using -b -n1 and parse the output with additional commands.
 
Old 10-12-2011, 05:51 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,124

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Note the warning under "BUGS".
If I want that sort of thing (with no header) I prefer "ps" piped to something like head.
 
  


Reply



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
LXer: Can You Top This? 15 Practical Linux Top Command Examples LXer Syndicated Linux News 0 01-09-2010 09:42 PM
Finding the top CPU-using processes? "top" command does not help... catalytical Linux - Server 1 04-06-2009 04:50 PM
top command Volcano Programming 18 10-15-2008 10:02 PM
top command maooah Solaris / OpenSolaris 17 08-17-2008 07:43 PM
Top command mtnpaul Linux - Software 2 04-17-2008 04:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:25 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