I am running a Debian flavor of Linux, and I use htop to keep track of memory usage, since it is more detailed than top. I can't seem to get it to sort by memory and display process trees at the same time. Is there a way to do this with htop or an alternative?
4 Answers
A 2019 update on this 2014 question that ranked highly when searching for this topic is that htop has this built in now, and in the current version 2.2.0, simply pressing t in the default view generates a process hierarchy.
- 239
Looks like Glances should have what you need:
glances --tree
And then sort using commands m,t, i etc. Full command reference
- 213
- 1
- 6
- 129
In htop version 3 (I believe, 3.0.3 to be exact) you can sort by other columns than pid even in tree mode.
See the changelog.
It's not perfect, because it doesn't aggregate memory from sub processes, but it's a nice feature nonetheless.
- 4,345
Not with htop (and probably with any other alternative) as both views are mutually exclusive: either you list processes sorted by memory, or respect the PPID/PID tree view. You can have both at the same time.
- 1,518