23

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
  • 418
  • 2
  • 5
  • 11

5 Answers5

7

Possible as of 3.1.0 (not yet in all distributions)

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
  • 296
  • 2
  • 8
  • 1
    Works with 3.2.1, just tested it. Just to add that you first need to press F5 to create the tree hierarchy and then press asterisk to collapse all trees. – geo909 Oct 27 '22 at 08:45
6

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

x3l51
  • 201
  • 2
  • 3
6

You can use the * key

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

congusbongus
  • 805
  • 1
  • 10
  • 13
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
  • 1
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://superuser.com/help/whats-reputation) you will be able to [comment on any post](https://superuser.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/1102158) – DarkDiamond Jan 12 '22 at 14:26
-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
  • 4,866
  • 1
  • 26
  • 36
treaki
  • 52
  • 1
  • 6