"who -m" does not work

1

I want to find out which machine I have logged in to my current terminal from. But "who -m" does not work. It does on Linux, but not on Solaris. Any ideas what I might be doing wrong?

myhost2:/home/myuser> who
myuser   pts/1        Aug  9 07:35   (myhost.mydomain.com)
myuser   pts/2        Aug  9 08:42   (myhost.mydomain.com)
myuser   pts/3        Aug  9 08:42   (myhost3.mydomain.com)

myhost2:/home/myuser> who -m
myuser   pts/2        Aug  9 08:42

myhost2:/home/myuser> who am i
myuser   pts/2        Aug  9 08:42

myhost2:/home/myuser> which who
/usr/bin/who

myhost2:/home/myuser> alias who
who: alias not found

myhost2:/home/myuser> uname -a
SunOS myhost2 5.10 Generic_138889-08 i86pc i386 i86pc

myhost2:/home/myuser> tty
/dev/pts/2

myhost2:/home/myuser> TTY=$(tty | cut -c 6-);who | grep "$TTY " | awk '{print $6}' | tr -d '()'
myhost.mydomain.com

dogbane

Posted 2010-08-09T08:02:22.870

Reputation: 3 771

Answers

2

A Solaris 10 box here seems to do the right thing:

$ uname -srv
SunOS 5.10 Generic_138889-08

$ who -m
myuser     pts/2        Aug  9 10:00    (hostname.my.domain.com)

Might this be dependent on how you are logging into the Solaris box? SSH / Telnet / XTerm ?

njd

Posted 2010-08-09T08:02:22.870

Reputation: 9 743

That's interesting. I'm using putty SSH. It's strange that "who" shows me my machine, but "who -m" doesn't. – dogbane – 2010-08-09T10:55:23.673

Hmm. PuTTY here too. And of course the general "who" and "who -a" show the connecting host. – njd – 2010-08-09T15:57:06.927

who is probably an alias, which may be why who -m misbehaves. alias who will show you if it is an alias. – jim mcnamara – 2010-08-10T21:34:05.357

nope, who is not an alias. Even the fully qualified command "/usr/bin/who -m" produces the same output. – dogbane – 2010-08-11T09:35:42.010