13

I want an easy way in linux to kill all my current processes.

The problem with kill -9 -1 is that it also kills the current terminal. Is there an easy way to kill everything except the current terminal?

0

2 Answers 2

9

This kills all processes except the ones associated with the current terminal:

kill `ps -o pid= -N T`
3
  • doesn't work under debian. ps lists all processes
    – ThorstenS
    Jul 16, 2009 at 11:04
  • The "T" argument to "ps" selects all processes associated with the current terminal and "-N" will negate that.
    – Inshalla
    Jul 16, 2009 at 16:32
  • That may well be ... but if executed as root or under sudo that brings down the system. stackoverflow.com/questions/53048310/… :D
    – tink
    Oct 29, 2018 at 16:39
2

But just want to say don't use -9 as a knee jerk mechanism as it should be used as a last resort. It can't be caught by the process and doesn't let a process cleanup its resources.

Try maybe kill -15 instead to start.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .