Okay, first off, this is not a tutorial to show you how to kill your nemesis. For that, you need to take shooting lessons (or maybe, learn how to mix poisons).
Killing here means logging out a user. This can be particularly useful if somebody has logged into your PC whom you don’t want to have access. Or whom you simply don’t like.
For instance, if you are managing a server, and a particular user is eating up all the bandwidth and also won’t listen to reason, you can just log him out. Simple as that.
There’s a good set of utilities called “procps” which might come handy. It contains a tool called “skill” which helps you send signals and such to users and other active (or inactive) processes.
Okay, enough talk. Let’s send some cool signals.
The syntax of the skill command looks like this:
skill -SIGNAL -u USERNAME
There are a possible number of signals you can send. And obviously, you will be sending those signals to the user with username “USERNAME”.
Signals to send to users
You can send these different signals to users:
- stop; which means you want that user’s activities to be halted. It’s like pushing the “Pause” button on a video set.
- cont; is the resume button, whereas “stop” was the pause. You can use “cont” to allow the user to continue with his/her activities.
- kill; now, this sounds like something the Dark Lord would have loved. You send the “kill” signal, the user’s session ends.
Example: Logging out “mr-enemy”
Okay, suppose your enemy – with the convenient user name “mr-enemy” – has logged into your system, and you want to log him out, just to spite him.
Here’s what you do:
skill -kill -u mr-enemy
Easy, no? You can also halt his session to irk him some more:
skill -stop -u mr-enemy
More Information
One thing to note, is that to stop a user you have to be “root”. More information on the skill command can be found by typing into your shell:
man skill
There, you will (probably) see that it is a deprecated command. However, I myself couldn’t find a replacement.
Other useful commands from the procps package include: top, kill, w, free, and vmstat.
Tired of your life?
No problem, you can even commit suicide with Linux shell:
skill –kill –u [yourusername]
where [yourusername] is replaced with your user name (surprise!).
Note: NEVER kill the “root” if you don’t want to cold reboot your system!