Re: How can I know the number of current users in the system?

From: Chris Abbey (linux@cabbey.net)
Date: Mon Nov 05 2001 - 20:20:52 EST


Today, Riley Williams wrote:
> Here's a simple shell command to provide that information:
>
> who | wc -l
>
> Try it and see...

Actually that's not a fair count of the number of users on the box,
only the number that are *logged in*. On one of our boxes at work,
that would miss about 80% of the users, maybe more. Anyone that
RSH's or SSH's in without a tty wouldn't be counted:

cabbey@CHESIRE ~> ssh -T tweedle who
cabbey@CHESIRE ~>

so even though I was executing who on tweedle it didn't see me
logged in. A more realistic situation:

[cabbey@tweedle cabbey]$ who
cabbey pts/0 Nov 5 19:05
cabbey pts/1 Nov 5 19:05
[cabbey@tweedle cabbey]$

pts/0 is my pine session, pts/1 is the shell I executed who in,
there are also two copies of "xeyes" running back to chesire
that were started as 'ssh -T tweedle /usr/X11r6/bin/xeyes -display
chesire:0' but don't appear in who

going back to running it remotely:

cabbey@CHESIRE ~> ssh -T tweedle who
cabbey pts/0 Nov 5 19:05
cabbey pts/1 Nov 5 19:05
cabbey@CHESIRE ~>

If those were move cpu hungry programs than xeyes,
like vncserver with a complete kde/gnome desktop
running under it then you could really be missing
some data from a scheduling pov... which as I recall
was what the original poster wanted to fiddle with.

-- 
now the forces of openness have a powerful and
  unexpected new ally - http://ibm.com/linux

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Nov 07 2001 - 21:00:28 EST