top used to support the '-M' option. It was used decide which units memory was displayed in for the machine Kib, MB, GiB etc. On RHEL 6.x this works, but it is not supported on later releases of the procps package. On RHEL 7.x it's not available as an option. Does anyone know if there is an alternative command line option for top, or why it was removed?
I don't know why it was removed, but in current versions of
top you can change the scaling in the summary window using E, and in the task window using e; successive keypresses move through the various scales available.
The settings can be stored in a configuration file; set things up as you like them, and press W to store all the settings in
~/.toprc. The relevant settings for memory scaling are
~/.toprc uses GiB in the summary and MiB in the task list. There doesn't seem to be a way of specifying this on the command line.
The -M option was a non-standard RedHat addition. It was never part of the standard procps top. I'm not sure why it was removed, possibly it interfered with the scaling in other parts of top.
So you have two choices.
- Set the scaling with the E key, as explained above
- Use the -E option, for example top -E g will show the units in GB. You get the choices of k,m,g,t,p,e (for those times you have something using Exbibytes!)