24

I would like to be able to collapse all the trees in the default view of htop. Is there a way to achieve that at once, instead of selecting every tree and hitting F6?

geo909
  • 436

5 Answers5

10

Possible as of 3.1.0 (available in repos since Ubuntu 22.10)

As of htop --version 3.1.0, you can in fact toggle-collapse all branches of the tree view (F5) using hotkey * (asterisk). The release happened only on 2021-09-21, so most 2022 linux distributions (except those with rolling releases) are about to receive the updated version with their next release.

For example, the Ubuntu package overview for htop shows that

  • ❌ Ubuntu 21.10 (impish) and 22.04 LTS (jammy) both stick to version 3.0.5 and only
  • Ubuntu 22.10 (kinetic) ships with 3.2.1.

And just for completeness sake:

  • Collapsing and expanding invidivual tree nodes was/remains possible using - and +
  • To review all key bindings in your version of htop, simply enter the help screen (? or h or F1)
ojdo
  • 376
7

AFAIK "t" is the hotkey for expansion and collapsing tree view in htop.

x3l51
  • 211
7

You can use the * key

This was implemented in version 3.0.5 (2021-01-12)

2

It is still not implented. Moreover, F5/F6 were "killed".

Besides, +/- do not work from keypad. As a result, the whole idea of tree-view became useless (as for me it is the only possible way to represent a lot of processes)

Dorco
  • 21
-7

I don't know about any option to expand/collapse individual branches in htop's tree view (or any other ncurses-based software¹). I would suggest not to presume things of text-based applications from things you have learned from graphical ones².

You can (only) enable/disable tree based view using F5.

Notes:

  1. I've got somehow used to the different design pattern in text-based (DOS era and ncurses or similar based Unix ones) and graphical applications. This collapse tree thing was, in my eyes, a thing invented in Windows.

  2. I would suggest anyone who want to get used to Unix systems disable their GUI for at least a week and learn things again from the bottom up.

Toby Speight
  • 5,213
treaki
  • 52