Kill pts session Linux Users

Thanks to

Let’s assume that you are connected to a server via ssh and for some reason you get disconnected. Then most probably you will be left with an idle user session on the server.

The w command can tell you in linux about who is connected to the server. And you can easily see here in the idle collumn that there is one idle session from the user ‘tasos’.

root@srv1 [~]# w
11:55:34 up 5 days, 15:12,  1 user,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
tasos pts/0 11:08    29:23 0.01s  0.09s sshd: tasos
tasos pts/1 11:40    0.00s   0.03s  0.07s sshd: tasos

There are many ways to kill such a session. Below i will show you one of them.
First run pstree -p and try to find something like this…


After the pstree -p command we have to find the parrent pid for the dead session (ssh in our example) . So after we find something like the example above we have to kill -1 the parent pid.

In our example you can see that there is one common process, sshd(32560) with two branches for the two users being connected (1 is me, the current user and the other is the user with the dead session which happens to be me again).

The solution is to kill the branch with the dead user…In our example this would be sshd(28407)….so simply do a kill-1 28407 and then with the w command you can see that there is only one user connectd…you!


skill -KILL -v pts/0


$ ps -ft pts/2

$ kill -9 11236
Posted in Linux

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: