92

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?

Unapiedra
  • 1,620

7 Answers7

63

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".

grawity
  • 501,077
55

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.

Blind Navigation v2 (2020-07)

Thanks to islandman93:

New blind navigation: F2, right, delete, right, delete. Then you probably want to add cpu average to the left column

Unapiedra
  • 1,620
4

htop v3.2.2 (Oct 22, 2022) has hotkey # that toggles header meters.

Also CPU cores can be split into 8 or 16 columns to take less space (F2 - Setup).

Vanav
  • 296
1

To minimize the appearance of the CPU bars:

F2, down arrow twice to "Meters", right arrow to "Column 1" and delete the CPU meters, then to "Column 2" and delete the CPUs meters if present. Then right arrow over to "Available meters" and select "CPUs (1-8/8) [Bar] and put it in Column 1.

fitchad
  • 11
-3

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.

-3

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.

Grizly
  • 879
-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