Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
I also tried unmounting /dev/pts1 but the session remained mounted – j0h Jul 13 '13 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 '13 at 22:05
up vote 1 down vote accepted

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.

share|improve this answer

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}')

share|improve this answer
Could you explain what it does exactly? – gertvdijk Jul 15 '13 at 22:05
Sorry, I misread your post. Updated my response – Chris Montanaro Jul 15 '13 at 22:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.