26

I like to use htop to show me how the server is being used.

Unfortunately with modern servers, the machine might have 48 or even 120 cores. This means that I can only see the first few lines of htop and never the second half of the htop display that shows which processes are using the machine.

How can I hide all of the core-usage lines or even better aggregate them for some sort of statistic?

18

Open the setup screen using F2 or ShiftS. The first page of that screen is dedicated to configuring header meters, so you can remove "CPUs" and add "CPU average".

In recent htop versions, there also are "CPUs (1&2/4)" and "CPUs (3&4/4)" meters showing two cores per line, though this is more of use on 8–32 core systems.

To save two more lines, open the "Display options" page and turn off "Leave a margin around header".

  • 5
    Doesn't work. On a smaller machine it works. A configuration page pops up under the CPU usage bars. But on the bigger machines it doesn't appear because the CPU usage bars take up all of the screen... Any other idea? (And yes, it took me 2 hours to figure out why nothing changed when pressing F2) – Unapiedra Sep 3 '14 at 12:48
18

Based on grawity's answer, you can create a configuration that you like on a different machine and then copy it to the machine where the problem occurs.

The configuration is saved (under Debian) under ~/.config/htop/htoprc.

  1. On a machine where you can see past the header:
  2. Press F2 to get into the configuration.
  3. Move left to the "Left Column"
  4. Move down to select "CPU" and press F9 to delete it.
  5. From the right most column select "CPU Average" and press F5 to insert it instead.
  6. F10 let's you leave the menu.
  7. copy ~/.config/htop/htoprc to the larger machine.

In my case (120 cores) a configuration with "CPUs (1&2/4)" on the left side of the header, and "CPUs (3&4/4)" on the right side of the header looks good. As a result, the header takes up about half the screen and the other half lists the processes. Each line in the header shows four CPUs which is fine for me.

Sample configuration:

# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 17 18 38 39 40 2 46 47 49 1 
sort_key=46
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=0
show_thread_names=0
highlight_base_name=0
highlight_megabytes=1
highlight_threads=0
tree_view=0
header_margin=1
detailed_cpu_time=0
cpu_count_from_zero=0
color_scheme=0
delay=15
left_meters=Memory Swap CPU Load LoadAverage 
left_meter_modes=1 1 1 1 1 
right_meters=Tasks LoadAverage Uptime 
right_meter_modes=2 2 2 

Alternative (Blind navigation)

Press F2, left, F9. (If CPUs are the items in the header.) After this you can see what is going on and would continue by pressing F10 to quit the configuration.

  • 2
    Blind navigation worked perfectly! – zplizzi Mar 26 '18 at 21:46
-1

Try the 't' key.

None of the other answers helped. My top and terminal must be different. My top was installed via the procps-3.2.8-45.0.1.el6_9.1.x86_64 package on Oracle Enterprise Linux (repackaged RedHat Enterprise Linux) 6.9 and I was accessing it via PuTTY 0.62.

  • Well the thread is about htop, not top. – grawity May 23 '18 at 20:15
-1

I just had this issue as well, system has 24 cores, boatloads of disks and interfaces, and I couldn't read the process data after all the mem/disk/net lines etc..

Simply starting it differently was the easiest solution:

atop -l

From the man page: Limit the number of system level lines for the counters per-cpu, the active disks and the network interfaces.

-3

SuSE : Press F2, Press F10, press q, sed -i 's/AllCPUs/CPU/g' ~/.htoprc

debian : Press F2, Press F10, press q, sed -i 's/AllCPUs/CPU/g' ~/.config/htop/htoprc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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