beer9
asked on
Usage of negative pid in kill command
I have seen in few example where the negative pid was used with 'kill' command to kill all process of a user. Could someone please let me know how it can be done?
Could someone please let me know how does it works? using above example how can I kill all the process of a particular uid/user?
Will kill all your processes, including the shell you're on/your ssh connection
kill -9 -1 -1
to kill all d process including login shell:
kill -9 0
Could someone please let me know how does it works? using above example how can I kill all the process of a particular uid/user?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
echo $$ # get your current shell pid , say 1234
pstree -pl -H 1234 # show the process tree, which 1234 branch highlighted.
say
bash (1234) ----pstree( 1239)
|--java (1235)
|--perl (1236)
So, the current process goup is root as 1234 and include child processes 1235, 1236, and 1239.
When you issue
kill -9 0
it kills processes 1239, 1235, 1236 and 1234.