Killing all python scripts except grep process and a specific python script
2
votes
2
answers
2658
views
How can I run command in bash to kill all python scripts except script called
test.py
and the grep
's pid itself, in case we are using something like ps -ef |grep
I think I can use something like pgrep python to ignore the grep process, but how do I also exclude the test.py script? I know there is an option to do grep -v
, is there option to do pgrep -v
***Clarification***: except grep process- means when we do for example ps -ef |grep test1.py
we get also the grep pid that used to bring this result.
I don't want to kill it as this process is no longer exist in the stage that results are shown.
Asked by user12345
(21 rep)
Sep 15, 2016, 03:13 PM
Last activity: Jun 23, 2025, 01:02 PM
Last activity: Jun 23, 2025, 01:02 PM