9

Is there a way to have the list of processes in htop only display as the name of the command, rather than the full pathname w/ flags?

Yewge
  • 193
  • 1
  • 1
  • 6

5 Answers5

6

As an update, now apparently there is an option in Setup/DisplayItems Show Program Path that is checked by default. Just need to uncheck that so only the command name is shown.

mfink
  • 198
  • 1
  • 5
3

Apparently not. You can however go to Setup/DisplayItems to Highlight the basenames.

It doesn't only list the command like you want, but it atleast makes it a little more visible.

Joel K
  • 5,853
  • 2
  • 30
  • 34
  • Ah. The highlighting helps a lot. Thx. Seems sort of dumb to not provide an option for basename-only listings, though -- it's extremely noisy the way it is now. – Yewge Jan 20 '10 at 13:51
  • There's a PR in htop github that may help resolving this issue some day: https://github.com/hishamhm/htop/pull/184 – Greg Dubicki Aug 07 '15 at 09:59
3

To make htop display only nginx processes:

htop -p $(pgrep nginx | paste -s -d,)
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
user455503
  • 31
  • 1
  • `htop -p $(pgrep nginx | paste -s -d, )` the space before the last closed bracket is important else the command gives an error `htop: option requires an argument -- 'p'` in my case. Second, the mentioned error occurs, when no process of this name is running at all – Hartmut Pfarr Feb 01 '20 at 11:53
2

As an addition to @mfink answer.

When you open htop, press F2, then scroll to Display options, left arrow, scroll down to Show program path and uncheck with space.

enter image description here

1

As an addendum to previous answers, that pointed to F2/Display Options/Show program path.

You can toggle this on/off by pressing p in the main screen of htop.

Lars
  • 11
  • 1