Linux 为什么/dev/pts中有23个文件,而使用who命令只显示8个pts?
仅使用8个pts文件Linux 为什么/dev/pts中有23个文件,而使用who命令只显示8个pts?,linux,ssh,centos,pts,Linux,Ssh,Centos,Pts,仅使用8个pts文件 [root@home tmp]# who root pts/2 2012-08-15 18:36 (:pts/1:S.0) root pts/6 2012-08-21 16:36 (10.10.11.168) root pts/3 2012-08-15 19:24 (:pts/1:S.1) root pts/10 2012-08-15 21:04 (:pts/1:S.2) root
[root@home tmp]# who
root pts/2 2012-08-15 18:36 (:pts/1:S.0)
root pts/6 2012-08-21 16:36 (10.10.11.168)
root pts/3 2012-08-15 19:24 (:pts/1:S.1)
root pts/10 2012-08-15 21:04 (:pts/1:S.2)
root pts/14 2012-08-16 02:41 (:pts/1:S.3)
root pts/12 2012-08-17 09:14 (:pts/1:S.5)
hugemeow pts/9 2012-08-21 16:36 (10.10.11.168)
root pts/22 2012-08-21 22:26 (10.10.11.168)
但是目录/dev/pts/中有23个文件,怎么了?
谁用了其他15个文件
[root@home tmp]# ls /dev/pts/ | wc -l
23
[root@home tmp]# ls /dev/pts
0 10 12 14 16 18 2 21 3 5 7 9
1 11 13 15 17 19 20 22 4 6 8
顺便说一句,我现在使用screen和tmux通过ssh客户端连接到远程服务器:)并不是所有使用的
pty
都对应一个登录shell,这是who
报告的内容。您可能会打开其他窗口(xterm
,konsole
,gnome terminal
,…),这些窗口与新的登录会话不对应(通常通过运行login
,或为您正在使用的任何窗口程序提供特定选项来创建)。但我没有在centos上安装gui:(那么,如何知道哪个进程正在使用特定的pts文件呢?您可以尝试fuser/dev/pts/
。此外,当某个进程停止使用pts文件时,内核可能不会立即释放它们。