I have read this these generic instructions to log users out, but I want more detail.

When I run the command users I see multiple instances of the same user. IE: Joe Joe Joe Joe Joe

How do I know if Joe is active? How would I find more information about what Joe is doing in each session? (like can I close a session Joe has open, and not loose his work?)

I am familiar with the w command. Say this user left his terminal on at home, then came into work; but rebooting the server isn't a good idea, I just used the command

pkill -KILL -u Joe bash 

This threw me out of the shell and out of the open-shell from home, with no idea if I'm loosing work in this process.

What can be done to help me evaluate which sessions can be closed safely?

I tried

skill -KILL -v /dev/pts/1 

to kill a specific session, but nothing happened.

  • I also tried unmounting /dev/pts1 but the session remained mounted
    – j0h
    Jul 13, 2013 at 16:34
  • Why do you need to kill with signal 9 (SIGKILL)? This should really only be used as the last resort! Processes won't get any time from the kernel to cleanly shut down and data loss is imminent!
    – gertvdijk
    Jul 15, 2013 at 22:05

2 Answers 2


I would recommend using w to identify the idle tty, then send it SIGHUP:

pkill -SIGHUP -t pts/5

SIGHUP (the hangup signal) will terminate the session more gracefully, almost as if the user had issued the logout command herself. SIGKILL should always be a last resort.


I must have misread a portion of your post.

There is not a good way of reconnecting to terminal session that you have lost connection to unless you are using screen or something similar. Here is a stackexchange post on launching screen on ssh connections:



This is not a solution to this problem

kill -9 $(ps aux | grep "[ ]$(who | grep 'Joe' | awk '{print $2}')" | awk '{print $2}')

  • Could you explain what it does exactly?
    – gertvdijk
    Jul 15, 2013 at 22:05
  • Sorry, I misread your post. Updated my response Jul 15, 2013 at 22:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .