I'm on Ubuntu 18.04. I'm already aware that I can start
htop, and then hit F4 for filter, then type or paste a process name search query (say,
gphoto2 for looking for
gvfs-gphoto2-volume-monitor.service), and then htop filters the shown processes: if there is no such process, it shows nothing, if it starts later,
htop shows it then.
Now, I would like to start
htop with filtering already from the command line, say:
... and get the exact same behavior as if hitting F4 and typing in the terminal UI. This would be useful if integrating the command into, say, a
I browsed through
man htop, but unfortunately I cannot see such command line/option. Closest I've seen is
-p, which as noted in how to show only processes *not* matching a filter? :
htop -p "$(pgrep -vfd, 'java|python')"
This has the obvious disadvantage of not accounting for processes that start after htop starts running
So, is there a way to set up process name filtering on the command line at startup, such that it takes account for newly killed or spawned processes (as if hitting F4 in
htops terminal UI) - for
top, or any other similar program?