Find the answer to your Linux question:
Results 1 to 6 of 6
Uhg. I'm pretty sure this is super simple, but I've searched and searched and for the life of me I can't find any info on how to limit the columns ...
  1. #1
    Just Joined!
    Join Date
    Jun 2010
    Posts
    3

    Limit the Unix top command's columns via args

    Uhg. I'm pretty sure this is super simple, but I've searched and searched and for the life of me I can't find any info on how to limit the columns that display in the interactive top program with arguments passed from the command line. I recall seeing something formatted like this ...

    ~/top -f (kdx)

    which would only show the %CPU, UID, program name fields/columns.

    I'd like to display the results in a really narrow terminal window on the right side of my desktop.

    TIA,

    MikeG0

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    What distribution+version of Linux/Unix are you running? Not all tops are the same.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Jun 2010
    Posts
    3
    Ubuntu 10.04

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    This is from the top man page on my CentOS/RHEL 5.4 system:
    Code:
       2b. SELECTING and ORDERING Columns
           After pressing the interactive commands ’f’ (Fields select) or ΄o’ (Order fields)
           you will be shown a screen containing the current fields string followed by names
           and descriptions for all fields.
    
           Here is a sample fields string from one of top’s four windows/field groups and an
           explanation of the conventions used:
    
           -  Sample fields string:
                 ANOPQRSTUVXbcdefgjlmyzWHIK
    
           -  The order of displayed fields corresponds to the order of the letters in  that
              string.
    
           -  If  the letter is upper case the corresponding field itself will then be shown
              as part of the task display (screen width  permitting).   This  will  also  be
              indicated by a leading asterisk (’*’), as in this excerpt:
                  ...
                  * K: %CPU       = CPU usage
                    l: TIME       = CPU Time
                    m: TIME+      = CPU Time, hundredths
                  * N: %MEM       = Memory usage (RES)
                  * O: VIRT       = Virtual Image (kb)
                  ...
    
           Fields select screen  --  the ’f’ interactive command
              You toggle the display of a field by simply pressing the corresponding letter.
    
           Order fields screen  --  the ’o’ interactive command
              You move a field to the left by pressing the corresponding upper  case  letter
              and to the right with the lower case letter.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  5. #5
    Just Joined!
    Join Date
    Jun 2010
    Posts
    3
    Thanks, but I read the man pages ... I need to format the columns with top startup args.

    I can't find any info on how to limit the columns that display in the interactive top program with arguments passed from the command line.

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    Quote Originally Posted by MikeG0 View Post
    Thanks, but I read the man pages ... I need to format the columns with top startup args.
    I don't know if you can from the command line, but you might be able to script it and redirect the input characters needed to simulate user input from stdin. Example:

    top <<EOF
    fAbc
    EOF

    Ok. Tried that. Won't work. Get the error "top: failed tty get". Apparently it needs a real tty device to work. Oh well... sigh. I'll reply again if I have any better luck. Sorry.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...