I'm using htop
to interactively monitor my processes.
However, sometimes a few processes get "in the way" and I would like to filter them out.
Unfortunately, it seems that htop's built in filter (e.g. F4) only allows me to define a positive filter (only matches will be shown), and not negative filters (all but matches are shown).
Finally, I haven't found any documentation about the actual syntax of the search-string (regexes don't seem to work).
Best Answer
I don't know if it's doable with
htop
but if using anothertop
implementation is an option, with thetop
implementation inprocps
on Linux (generally the default implementation there), from withintop
, you cano
(orO
for case sensitive matching)!COMMAND=notwanted
(or!USER=unwanted
)to filter out the processes whose name (or command line after pressing
c
) containsnotwanted
(or whose username containsunwanted
). Enter=
to remove all the filters.You can filter on any of the fields you want, but only when they are displayed. For instance, to exclude kernel tasks, you can ask for the
CODE
column to be displayed (withf
) and then filter onCODE>0
(witho
).Note that the default interface of that
top
implementation may look cruder than that ofhtop
, but it has actually quite a lot more features (and you can configure it with colour and extra information if need be).