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?
5 Answers
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)
- 296
- 2
- 8
-
1Works 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
AFAIK "t" is the hotkey for expansion and collapsing tree view in htop.
- 201
- 2
- 3
-
1
-
8For me it switches between tree and list so it doesn't really collapse. – Henrik Sommerland Jun 01 '18 at 12:39
-
-
4
-
1
You can use the * key
This was implemented in version 3.0.5 (2021-01-12)
- 805
- 1
- 10
- 13
-
Looks like it hasn't been released just yet, but apparently the + key works to collapse individual line entries. – Nickolai Jun 15 '21 at 18:41
-
1
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)
- 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
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:
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.
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.
- 4,866
- 1
- 26
- 36
- 52
- 1
- 6