Find the answer to your Linux question:
Results 1 to 4 of 4
hi everyone i would like to do the following task with top one run in batch mode showing the memory stats (VIRT RES SHR S %MEM CODE DATA) in Kb. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2011
    Posts
    6

    TOP in batch mode showing mem stats in Kb


    hi everyone i would like to do the following task with top

    one run in batch mode showing the memory stats (VIRT RES SHR S %MEM CODE DATA) in Kb.

    Is it possible ?

    Thanks a lot

  2. #2
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    626
    by default. it shows all those values in kb. as far as running once:
    Code:
    top -b -n 1
    linux user # 503963

  3. #3
    Just Joined!
    Join Date
    Feb 2011
    Posts
    6
    Quote Originally Posted by scathefire View Post
    by default. it shows all those values in kb. as far as running once:
    Code:
    top -b -n 1
    NO. IT DOES NOT.

    here are the first 3 lines

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    3058 oracle 20 0 2982m 451m 211m R 100 0.7 15972:48 oracle
    8203 oracle 20 0 1756m 637m 628m R 100 1.0 99:36.71 oracle
    30109 oracle 20 0 1751m 112m 109m R 100 0.2 15:28.32 oracle

    It is not showing DATA & CODE and the sizes are in Human Readable format

  4. #4
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    626
    You can control top with a toprc file. Can be a userfile or stuck in /etc/toprc.

    If it doesn't exist, run top interactively. Hit 'f', to add/subtract whatever fields you desire. (In your case its probably 'r' and 's'). Hit enter to exit the field selection. Hit 'W' to write a user toprc file. Then 'q' to exit.

    When you run top, it will show Data and Code now.
    Last edited by scathefire; 11-01-2011 at 10:51 PM.
    linux user # 503963

Posting Permissions

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