It looks like finger does the trick. It returns the long name of the user along with the host or tty of their login session.
To get who is logged in via remote sessions
finger | grep \* | grep \)$ | sed -e 's/[()]//g | gawk '{print $1"
"$NF}'
To get who is logged in via local session and format to be the same as
the above command
finger | grep \*:0 | gawk '{print $1" localhost"}'
On Sat, 2006-12-16 at 17:33 -0700, Mel Walters wrote:
> On December 12, 2006 02:03 pm, Roy Souther wrote:
> > Any idea how I can get the UID of people logged in? I am trying to use
> > who but it only returns the names and only the first seven letters of
> > the names, that is a problem for user names that are longer and have the
> > first seven letters the same as another users.
> >
> > I have tried to make who use wider columns but no luck.
> >
> > Royce Souther
> > www.SiliconTao.com
> > Let Open Source help your business move beyond.
> >
> w
> and
> who
> are the only ones I can remember at the moment. But I was able to get the the
> full name from using finger
> finger mwalters
> gave:
> Login: mwalters Name: Mel Walters
>
> This may not help at all by the way you described your problem, because you
> would need a unique login name to finger.
>
> What do you think?
>
> Mel
Royce Souther
www.SiliconTao.com
Let Open Source help your business move beyond.
For security this message is digitally authenticated by GnuPG.
signature.asc
Description: This is a digitally signed message part
_______________________________________________ clug-talk mailing list [email protected] http://clug.ca/mailman/listinfo/clug-talk_clug.ca Mailing List Guidelines (http://clug.ca/ml_guidelines.php) **Please remove these lines when replying

