Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Redhat EL5

I had my top configured the just the way I like showing the memory summary and swap summary in MB. I had to close my shell and then when I re-opened it, it is back showing in (default ?) kilobytes.

I have scoured google, and top help and man the page. I can not seem to find the display in MB option. Although, I did find many other somewhat strange options...

If anyone knows I sure would be grateful.


share|improve this question
Are you sure it was TOP and not a clone with more options ? there is nothing on TOP's man page saying anything about it being able to display the data in human-readable form. – Prix Oct 20 '10 at 5:45
I am sure it was top. The standard top that comes with Redhat Enterprise Linux 5. procps version 3.2.7 – Michael Irey Oct 21 '10 at 5:08

I know I'm veeery late on this but I guess you used:

top -M

from the tom man page on RHEL 5:

-M : Detect memory units
Show memory units (k/M/G) and display floating point values in the memory summary.
share|improve this answer
so much for searching the man page for "kilo" and "mega" to try to find this info. – Dan Pritts Aug 1 '13 at 14:21
tom -M not work for ubuntu,just for centos – janwen Aug 29 '13 at 2:22
neither fedora 20 – sivann Sep 19 '14 at 8:51

On linux you can use e key to change task memory scale, ranging from bytes to petabytes. When you have selected what you like, press W (shift + w) to save changes to ~/.toprc.

share|improve this answer

Let me amplify and study bindbn's response above. The source to top in the procps package, lines 3131 and 3134, show that the output will go through the scale_num() function defined on line 761. What I read in the scale_num() function says that it will favor precision over beauty. If the available real-estate only allows for human-readable, then so be it, but its default is to show it in KB.

So, what I think happened is that you saw a few processes with MB in their memory consumption (resident or shared) and tricked yourself when you opened it back up. Either that, or you were using a different tool.

If you are satisfied that somehow, you got twisted around, then please mark a reply as The Answer so that this question can come off the Unanswered list. Thanks.

Just to convince yourself, get the source RPM to the package and see if they applied any patches to it. You would probably have to install the SRPM and look at the spec file to get the name of any patch files they used. Learn how to build an RPM (a handy skill) and go look at the patched source of top.c, if it has been patched at all. Compare the tree with the link I provided above and see if there is a difference. Note that going through this may not be trivial.

share|improve this answer

Original top(procps 3.2.8) can not showing the memory summary in Mb(i view source code).

share|improve this answer
I was using the standard top that comes with Redhat Enterprise Linux 5. Honest, somehow I had it set to display in MB. But thanks for viewing the source code. procps version 3.2.7 – Michael Irey Oct 21 '10 at 5:05

"top -M M" is the command to get the memory part in megabytes. Change last M to K for kilobytes

"top -n 1 d 2" will repeat only once

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.