Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 09-09-2008, 03:55 PM   #1
LQ Newbie
Registered: Aug 2008
Posts: 3

Rep: Reputation: 0
Having problems sorting when I use "top" command

Is there a way to sort the top command by more than age, pid, CUP usage, mem usage and time? If I could sort by command name that would be extremely helpful.
Old 09-09-2008, 04:09 PM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
According to the man page, you can sort the following columns:

       SORTING of task window
         For compatibility, this top supports most of the former top sort keys.  Since this is primarily a  service  to  former  top  users,
         these commands do not appear on any help screen.
            command   sorted field                  supported
              A         start time (non-display)      No
              M         %MEM                          Yes
              N         PID                           Yes
              P         %CPU                          Yes
              T         TIME+                         Yes

         Before  using  any  of  the  following sort provisions, top suggests that you temporarily turn on column highlighting using the ’x’
         interactive command.  That will help ensure that the actual sort environment matches your intent.

         The following interactive commands will only be honored when the current sort field is visible.  The sort field might not be  visi-
         ble because:
              1) there is insufficient Screen Width
              2) the ’f’ interactive command turned it Off

         < :Move_Sort_Field_Left
              Moves the sort column to the left unless the current sort field is the first field being displayed.

         > :Move_Sort_Field_Right
              Moves the sort column to the right unless the current sort field is the last field being displayed.

         The following interactive commands will always be honored whether or not the current sort field is visible.

         F or O :Select_Sort_Field
              These keys display a separate screen where you can change which field is used as the sort column.

              If  a  field  is  selected  which was not previously being displayed, it will be forced On when you return to the top display.
              However, depending upon your screen width and the order of your fields, this sort field may not be displayable.

              This interactive command can be a convenient way to simply verify the current sort field, when running top with  column  high-
              lighting turned Off.

         R :Reverse/Normal_Sort_Field_toggle
              Using this interactive command you can alternate between high-to-low and low-to-high sorts.

         Note:  Field  sorting  uses internal values, not those in column display.  Thus, the TTY and WCHAN fields will violate strict ASCII
         collating sequence.
It's all in the man pages...


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
Checking multiple systems on network with command "top" using a Linux Script Echo Kilo Programming 16 06-15-2008 06:33 PM
Starting an xterm window that is "always on top" on command line azilkie Fedora 1 10-07-2005 09:17 PM
"Doubt in Implementing top command " manikantha Programming 1 09-24-2004 07:20 AM
How to make sense out of "top" command manofwax Linux - General 6 08-10-2004 11:59 AM
"top" command memory question chanys Linux - General 4 03-14-2003 08:01 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:27 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
Open Source Consulting | Domain Registration