这是结果who -uH
:
NAME LINE TIME IDLE PID COMMENT
me :0 2013-08-29 01:29 ? 1686 (:0)
me pts/0 2013-08-29 01:42 old 2905 (:0)
me pts/1 2013-08-29 01:45 old 2905 (:0)
me pts/2 2013-08-29 01:52 old 2905 (:0)
me pts/3 2013-08-29 02:26 old 2905 (:0)
me pts/4 2013-08-30 18:37 00:07 2905 (:0)
me pts/5 2013-08-29 10:34 old 2905 (:0)
me pts/6 2013-08-29 11:05 old 2905 (:0)
me pts/7 2013-08-29 13:34 old 2905 (:0)
me pts/8 2013-08-30 15:56 02:45 2905 (:0)
me pts/9 2013-08-30 18:27 00:17 2905 (:0)
me pts/10 2013-08-30 17:34 . 2905 (:0)
me pts/11 2013-08-30 17:37 00:13 2905 (:0)
me pts/12 2013-08-30 18:28 00:17 2905 (:0)
me pts/13 2013-08-30 18:38 00:07 2905 (:0)
Run Code Online (Sandbox Code Playgroud)
为什么它在 15 行中列出了我的用户名?我如何知道是否有人远程连接到我的系统?
它为他们拥有的每个物理和虚拟终端列出一个用户。
pts#
):0
和/或tty#
)注:该#
上方是像1,2,3等的实际数目。
每次打开一个选项卡都gnome-terminal
算作一个虚拟终端。使用 tty 终端登录您的系统。这些可以使用组合键访问:Control+ Alt+ Fn#。
$ w
10:37:37 up 8 days, 21:05, 11 users, load average: 2.24, 2.08, 2.13
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
saml tty2 - 10:33 3:47 0.12s 0.12s -bash
saml tty1 :0 21Aug13 9days 16:07m 0.02s pam: gdm-password
saml pts/0 :0.0 21Aug13 9:57m 0.37s 0.37s bash
saml pts/1 :0.0 21Aug13 8days 0.28s 0.28s bash
saml pts/6 :0.0 21Aug13 36:23m 3.16s 3.16s bash
saml pts/9 :0.0 22Aug13 33:52m 5.92s 5.92s bash
saml pts/13 :0.0 Tue12 39:53m 2:37 2:37 irb
saml pts/27 :0.0 03:15 7:12m 0.21s 0.21s bash
saml pts/28 :0.0 08:42 0.00s 0.18s 0.00s w
saml pts/29 :0.0 10:36 8.00s 0.18s 0.01s ssh catbus
saml pts/30 192.168.1.200 10:37 3.00s 0.14s 0.14s -bash
Run Code Online (Sandbox Code Playgroud)
我的 X 服务器正在运行tty1
,:0
显示了我从哪里连接到这个终端。:0
并:0.0
表示主 X 服务器。
以上是告诉你我有 2 个 tty 终端打开 + 7 个虚拟终端。
最后一行演示了用户在使用ssh
远程进入系统时显示的内容。您可以看到它们来自何处的 IP 地址。
为了完整起见,这是我的输出who -uH
:
$ who -uH
NAME LINE TIME IDLE PID COMMENT
saml tty2 2013-08-30 10:33 00:18 1735
saml tty1 2013-08-21 13:33 old 2008 (:0)
saml pts/0 2013-08-21 13:35 10:12 3240 (:0.0)
saml pts/1 2013-08-21 13:47 old 3240 (:0.0)
saml pts/6 2013-08-21 15:21 old 3240 (:0.0)
saml pts/9 2013-08-22 09:37 old 3240 (:0.0)
saml pts/13 2013-08-27 12:14 old 3240 (:0.0)
saml pts/27 2013-08-30 03:15 07:27 3240 (:0.0)
saml pts/28 2013-08-30 08:42 . 3240 (:0.0)
saml pts/29 2013-08-30 10:36 00:15 3240 (:0.0)
saml pts/30 2013-08-30 10:37 00:15 14092 (192.168.1.200)
Run Code Online (Sandbox Code Playgroud)