LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 05: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, 05:49 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

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

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

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

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
In interactive mode press n then 5.
 
Old 10-12-2011, 05: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, 06:02 PM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
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, 06:51 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,832

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


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 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 10:42 PM
Finding the top CPU-using processes? "top" command does not help... catalytical Linux - Server 1 04-06-2009 05:50 PM
top command Volcano Programming 18 10-15-2008 11:02 PM
top command maooah Solaris / OpenSolaris 17 08-17-2008 08:43 PM
Top command mtnpaul Linux - Software 2 04-17-2008 05:25 AM


All times are GMT -5. The time now is 03:54 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration