LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Need to See Logged In Users (https://www.linuxquestions.org/questions/linux-general-1/need-to-see-logged-in-users-4175454518/)

Brandon9000 03-18-2013 08:06 AM

Need to See Logged In Users
 
If I open several Gnome terminal windows and on one of them type:

su - gwashington

and log in for that user, then the command prompt changes to show me that I am now user gwashington, which is also confirmed if I run whoami. Furthermore, running "ps" shows several processes owned by gwashington.

However, if I run the command "who," "w," or "users," I see only my actual userID in the list and user gwashington is nowhere to be found. How can I see a complete list of logged in users? I will not be satisfied with a clever explanation of why I don't see the gwashington ID. I need to be able to detect it in a full list of users.

Thanks in advance.

Brandon

eklavya 03-18-2013 09:29 AM

If you want to detect all users as well as users who are logged in by other users, you can use this.

Code:

ps auh | cut -d ' ' -f1 | sort -n | uniq

Brandon9000 03-18-2013 12:21 PM

An interesting idea, but I don't want to get users who have logged off but left processes running. Also, I do want to get users who are in by telnet, ssh, etc.

chrism01 03-18-2013 08:45 PM

Try
Code:

ps -ef|awk '{print $1}'|sort -u
??

Brandon9000 03-19-2013 06:52 AM

I don't want to get users who have logged off but left processes running. Just logged in users.


All times are GMT -5. The time now is 03:36 PM.