“who -m”不起作用

“who -m”不起作用

我想找出我从哪台机器登录到当前终端。但是“who -m”不起作用。它在 Linux 上有效,但在 Solaris 上无效。有人知道我可能做错了什么吗?

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

答案1

这里的 Solaris 10 盒子似乎做了正确的事情:

$ uname -srv
SunOS 5.10 Generic_138889-08

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

这可能取决于您如何登录 Solaris 系统?SSH / Telnet / XTerm?

相关内容