Ubuntu: Why does this 'kill' command log me out of the computer?



Question:

The following command signs me out (do not run this command):

kill -9 -1  

I don't understand why.

Can someone explain this to me?


Solution:1

The syntax is kill SIGNAL PID.

The -9 option specifies that the SIGKILL signal should be sent (immediately terminate the target process(es), and specifying the PID -1 is shorthand for "all processes except itself and init".

Since you don't use sudo (and presumably don't have root permissions), this immediately kills all processes you have permission to kill - your entire session, hence logging you out.


Solution:2

try

man kill  

to get an explanation of the kill command..

it says:

A PID of -1 is special; it indicates all processes except the kill process itself and init.

and

EXAMPLES

kill -9 -1

 Kill all processes you can kill.  

I hope you understand why your computer will log you out, when you end all processes. You quitted everything.

Hope this helps.


Solution:3

You are giving -1 as the process id: from the kill man-page:

 A  PID of -1 is special; it indicates all processes except the   kill process itself and init.  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »