Everyday we kill tasks using the famous command “kill” or even “killall” but we can use then to kill a user. Both of then need the PID to kill and a user that is running nothing won’t have one. So now I will show how to “kill” someone on Linux.
First of all to execute this we need to be logged in as root. Now let’s find out who we are going to kill:
[[email protected] ~]# who wbot11 pts/0 2012-06-18 15:19 (10.0.0.66) wbot12 pts/1 2012-06-18 16:23 (10.0.0.69) wbot13 pts/2 2012-06-20 11:19 (10.0.0.61) sacimp pts/3 2012-06-20 11:22 (10.0.0.65) [[email protected] ~]#
Well now that we have listed all users that are logged on, lets choose who is going to be killed. (I have chosen the user “sacimp”)
[[email protected] ~]# skill -KILL -v pts/3
We will have this as output:
pts/3 sacimp 9985 bash pts/3 sacimp 10028 top [[email protected] ~]#
Well now I will explain the flag -v and others flags that can be useful.
The flag -v means verbose output, it will display what was running on that killed terminal, that’s why we knew what “sacimp” was doing.
We can kill using -t for terminal (tty or pty) and -u for username instead of pts.
That’s it! How easy is to kill someone on Linux.