Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 2
    Unless the process is rogue, kill -n 9 should not be the first choice. Commented Sep 16, 2024 at 4:27
  • Thank you, "some command" is actually a while loop and when I used ps aux it seemed like the process name was that of the terminal that launched it so in my case one of the many zsh (like bash) processes. I think I can identify which one of the zsh processes it is by the status column in ps aux as it has N (for nice) but that might cause an issue if ever there is another zsh process with an N status Commented Sep 16, 2024 at 4:29
  • In any case I can upvote your answer as it does work in a lot of cases but I do not think the sudo is necessary in general and I think it is best to avoid using that when not necessary so I am reluctant to upvote your answer because of the sudo Commented Sep 16, 2024 at 4:30
  • There is a command which I will mention later that can both search for processes by name and remove them but doing that one removes all processes that match the string before verifying what the matches are which can lead one to remove process that should not have been removed. I prefer using pgrep which finds processes that match a string and then use pkill, the process I said I would mention later, which has the ability to remove processes that match a string. I use pgrep "part of name" then if I want to remove all of the matches I use pkill "part of name". Commented Sep 16, 2024 at 6:47