Wednesday, 28 May 2014

HOWTO: killing a TTY session using the command line

HOWTO: killing a TTY session using the command line

Recently one of my PuTTY sessions froze, and I decided to try and kill it using the command line, instead of simply closing the window.

This is the complete procedure:
I opened another PuTTY session
using the who command I found the name of the frozen TTY

myuser@ubuntu:~$ w
14:21:07 up 119 days, 12 min, 2 users, load average: 0.06, 0.05, 0.05
USER  TTY   FROM        LOGIN@ IDLE  JCPU  PCPU  WHAT
user1 pts/0 192.168.x.x 13:02  1:36  1.81s 0.10s sshd: user1 [priv]
user1 pts/2 192.168.x.x 14:21  0.00s 0.46s 0.00s w
myuser@ubuntu:~$

using ps and grep i found its PID
ps -u root | grep -i pts/0
finally, I killed the blocked session:

kill -9

No comments:

Post a Comment