Is there a
ps
or pgrep
option or standard practice what will let me list all the running processes on a machine EXCEPT for a few specific ones I don't want to see?
Put another way -- let's say I have four processes running
% ps
PID TTY TIME CMD
26712 ttys000 0:00.45 -zsh
28228 ttys001 0:00.23 -zsh
42083 ttys002 0:00.11 -zsh
42396 ttys002 0:00.16 node
and I have a text file with a few process IDs
% cat /tmp/no-interest.txty
26712
28228
I want a command line invocation that will display _just_ the process information for 42083 and 42396.
The more general problem I'm trying to solve is I want to show processes that started AFTER a certain point in time. I can get as far as building a list of currently running processes in a text file, but I'm blocked a bit on how to come up with a concise way to use this information to suppress the processes I don't want to see. I know how to do this with a short program in a variety of languages, but I'd like something I can invoke as a one liner and not have to worry about getting that program onto the specific machine I'm debugging.
Asked by Alana Storm
(1483 rep)
Jan 30, 2023, 11:26 PM
Last activity: Feb 3, 2023, 08:01 AM
Last activity: Feb 3, 2023, 08:01 AM