Super User is a question and answer site for computer enthusiasts and power users. 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 would like to have a list of all users that are active on my Linux system, including those who have running but detached screen sessions. The who command only shows me currently logged in users, but not users with detached screen sessions and the like.

I was contemplating parsing the output of ps but that would also make a user show if if he has a cron job running.

share|improve this question
up vote 3 down vote accepted


$ ps axno user,tty | awk '$1 >= 1000 && $1 < 65530 && $2 != "?"' | sort -u

This should tell you all UIDs with processes with a session terminal (like a window in screen). I use the UID to be weed out the 'system' users (like apache) and nobody (high UID), and ignore daemons.

share|improve this answer
Nice, thanks for this! – Sander Marechal Nov 3 '11 at 6:52

You can try who, and the output of ps with a grep:

~$ ps aux | grep screen

And filter on user:

~$  ps aux | grep screen | grep $USER

(replace $user with the username).

share|improve this answer

You must log in to answer this question.

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