linux – tty,ttyS,pts,ptmx,vcs,vcsa设备文件之间的区别?(/dev/tty等)
linux – tty,ttyS,pts,ptmx,vcs,vcsa设备文件之间的区别?
终端有字符终端和图形终端两种模式。在linux的图形环境下,我们可以通过鼠标点击来完成所有的管理任务,这是图形界面终端,另外一种就是文本界面的终端,
在这个界面的终端下我们可以使用linux命令来控制系统完成响应的工作,而这个文本终端也是服务器常用的模式
图形终端
字符终端
终端是一种字符型设备,它有多种类型,通常使用tty来简称各种类型的终端设备
物理终端:系统启动之前的控制台叫物理终端
虚拟终端:由软件虚拟出来的,系统启动之后由程序启动的终端,例如由mingetty程序启动的6个tty叫虚拟终端
模拟终端:远程登录或图形界面(startx)或pts
物理终端 /dev/console 串口调试Linux内核
虚拟终端 /dev/tty(0,6) -》login程序 用户名/密码
模拟终端 /dev/pts/# -》sshd程序 用户名/密码
console和terminal有什么区别?
简单来看,console就是计算机的原生的设备
- [root@ht8 pts]# ll /dev | grep con
- crw------- 1 root root 5, 1 Jan 5 19:39 console
- [root@ht8 pts]# cat /proc/devices | grep console
- Character devices:
- 5 /dev/console
所谓的terminal是附加的设备,通过串口或事其他设备连接。也就是说console(原生设备)只有一个,但是terminal(附加设备)可以有多个
linux中的TTY是什么? TTY,是teletypewriter的缩写,翻译过来就是电传打字机
- 说到Linux,TTY是UNIX和Linux中的抽象设备。有时它指的是物理输入设备,如串行端口,有时它指的是允许用户与系统交互的虚拟TTY。
- TTY是Linux和Unix中的一个子系统,通过TTY驱动程序在内核级别实现流程管理、编辑和会话管理。
- 实际上,每当启动终端模拟器或使用系统中的任何类型的shell时,它都会与被称为伪TTY或PTY的虚拟TTY进行交互。
- 您只需在终端模拟器中键入TTY即可找到关联的PTY.
在Linux系统的设备特殊文件目录/dev/下,终端设备文件有以下几种:
1)/dev/tty(控制终端)
tty是所有终端的统称,包括串口、控制台终端以及伪终端设备。
通过tty命令可以知道当前具体是什么终端(所以tty也代表当前的终端,echo hello > /dev/tty都会显示在当前的终端中,可能是上面的任意一种终端)。
dev/tty就是映射到dev/tty1-6之间的一个(取决于你当前的控制台号), 如果你现在是在图形界面(Xwindows),通过键盘快捷键 Ctrl+Alt+F1~6进行切换到不同的终端上
比如你可以输入命令 #tty 那么将显示当前映射终端如:/dev/tty1或者/dev/pts/0等。
- 目前我登录了2个终端
[root@ht8 src]# w- 16:07:59 up 80 days, 19:29, 2 users, load average: 0.59, 0.73, 0.72
- USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
- root pts/0 10.129.55.19 Sat10 7.00s 0.54s 0.00s w
- root pts/1 10.129.55.19 Sat20 16:18m 0.03s 0.03s -bash
//查看谁登录了该系统,同时可以杀死其他终端,从而把对方踢出去.
[root@ht8 src]# tty
/dev/pts/0
##/dev/tty是当前进程的控制终端的设备文件,可以使用命令”ps -ax”来查看进程与哪个控制终端相连。
[root@ht8 src]# ps -ef | grep tty
root 843 1 0 Jan05 tty1 00:00:00 /sbin/agetty --noclear tty1 linux
root 43237 37454 0 16:08 pts/0 00:00:00 grep --color=auto tty
##sbin/agetty就是用于打开一个tty终端,显示登录页面,agetty管理着虚拟控制台
//发送一个字符到另一个登录的终端(加入多个人登录了终端,就可以发给对方消息)
[root@ht8 ~]# echo "test,hello">/dev/pts/0
//从另外一个终端就是可以看到
[root@ht8 src]# test,hello
[root@ht8 src]# dmesg |grep tty
[ 0.000000] console [tty0] enabled // 看到这个启用.
pts--->对应多个tty
[root@ht8 pts]# pwd
/dev/pts
[root@ht8 pts]# ll
total 0
crw--w---- 1 root tty 136, 0 Mar 27 2022 0
crw--w---- 1 root tty 136, 1 Mar 27 16:38 1
crw--w---- 1 root tty 136, 2 Mar 27 17:24 2
c--------- 1 root root 5, 2 Jan 5 19:39 ptmx
在不同终端输出的数字就是tty终端号
[root@ht8 ~]# tty
/dev/pts/1
添加一个设备到/dev下则可以
- [root@ht8 dev]# mknod /dev/tty100 c 4 100
//语法 建立一个名为tty100的设备文件,c表示是字符文件,major(主设备号)=4, minor(次设备号)=100- [root@ht8 dev]# ll /dev/ | grep tty100
- crw-r--r-- 1 root root 4, 100 Mar 27 20:49 tty100
- //再次执行则会出现......
- [root@ht8 dev]# mknod /dev/tty100 c 4 100
- mknod: ‘/dev/tty100’: File exists
打开 /etc/systemd/logind.conf
文件并将 NAutoVTs=3 设置为你想要在启动时得到的虚拟控制台数量
- [root@ht8 src]# cat /etc/systemd/logind.conf
- # This file is part of systemd.
- #
- # systemd is free software; you can redistribute it and/or modify it
- # under the terms of the GNU Lesser General Public License as published by
- # the Free Software Foundation; either version 2.1 of the License, or
- # (at your option) any later version.
- #
- # Entries in this file show the compile time defaults.
- # You can change settings by editing this file.
- # Defaults can be restored by simply deleting this file.
- #
- # See logind.conf(5) for details.
- [Login]
- NAutoVTs=3
- #ReserveVT=6
- #KillUserProcesses=no
- #KillOnlyUsers=
- #KillExcludeUsers=root
- #InhibitDelayMaxSec=5
- #HandlePowerKey=poweroff
- #HandleSuspendKey=suspend
- #HandleHibernateKey=hibernate
- #HandleLidSwitch=suspend
- #HandleLidSwitchDocked=ignore
- #PowerKeyIgnoreInhibited=no
- #SuspendKeyIgnoreInhibited=no
- #HibernateKeyIgnoreInhibited=no
- #LidSwitchIgnoreInhibited=yes
- #IdleAction=ignore
- #IdleActionSec=30min
- #RuntimeDirectorySize=10%
- #RemoveIPC=no
- #UserTasksMax=
关于dev/tty其实很简单:就是当前终端设备的一个链接(有点像/dev/tty0吧,但是他好像更强大一点),我们可以做下这个实验:
在Xwindow下打开多个终端(输入命令的窗口):#tty命令,发现在各个窗口分别显示为# dev/pts/0 #dev/pts/1 #dev/pts/2....
2)/dev/ttySn(串行端口终端)
计算机把每个串行端口都看作是一个字符设备,若要向一个端口发送数据,可以在命令行上把标准输出重定向到这些特殊文件名上即可。
例如,在命令行提示符下键入:echo test > /dev/ttyS1会把单词”test”发送到连接在ttyS1(COM2)端口的设备上。这些都是串口,不是并口.
注意:当今的计算机都配有键盘和显示设备,不再带有多个文本终端。于是“系统控制台”就由本地键盘和监视器担任。而当计算机主机没有连接显示硬件设备时,
一般就由串口设备 担任“系统控制台”。把串口设备的电缆插入就可以得到诊断信息和登陆提示字
串行端口终端(Serial Port Terminal)是使用计算机串行端口连接的终端设备。linux把每个串行端口都看作是一个字符设备。有段时间这些串行端口设备通常被称为终端设备,因为那时它的最大用途就是用来连接终端。这些串行端口所对应的设备名称是/dev/tts/0(或/dev/ttyS0), /dev/tts/1(或/dev/ttyS1)等,设备号分别是(4,0), (4,1)等,分别对应于DOS系统下的COM1、COM2等。若要向一个端口发送数据,可以在命令行上把标准输出重定向到这些特殊文件名上即可。例如,在命令行提示符下键入:echo test > /dev/ttyS1会把单词”test”发送到连接在ttyS1(COM2)端口的设备上。可接串口来实验。
- [root@ht8 pts]# ls -l /dev/ttyS*
- crw-rw---- 1 root dialout 4, 64 Jan 5 19:39 /dev/ttyS0
- crw-rw---- 1 root dialout 4, 65 Jan 5 19:39 /dev/ttyS1
- crw-rw---- 1 root dialout 4, 66 Jan 5 19:39 /dev/ttyS2
- crw-rw---- 1 root dialout 4, 67 Jan 5 19:39 /dev/ttyS3
3)/dev/ttyn,/dev/console(控制台终端)
使用Alt+[F1~6]组合键时,我们可以在tty1、tty2...切换,tty1~tty6等称为虚拟控制台,而tty0则是当前所使用的虚拟控制台的一个别名,系统产生的信息会发送到该终端上。
4)dev/pts/n(虚拟终端)或者叫伪终端
在XWindows模式下的伪终端,另外远程登陆的用户,就是使用telnet、ssh等远程登陆的用户,他的终端显示就是pts/n。
/dev/pts是远程登录(telnet,ssh等)后创建的控制台设备文件所在的目录
pts是远程虚拟终端。devpts是一个虚拟的文件系统,一般安装在/dev/pts。为了得到一个虚拟终端,进程打开/dev/ptmx,然后就可使用虚拟终端pts。
/dev/ptmx是master,其他的pts是slave,也就是一对多的关系.
pts与ptmx配合实现/dev/pty虚拟终端
- 目前登录2个终端
- [root@ht8 pts]# ll
- total 0
- crw--w---- 1 root tty 136, 0 Mar 27 17:23 0
- crw--w---- 1 root tty 136, 1 Mar 27 16:38 1
- c--------- 1 root root 5, 2 Jan 5 19:39 ptmx
- //继续登录终端
- [root@ht8 pts]# pwd
- /dev/pts
- [root@ht8 pts]# ll
- total 0
- crw--w---- 1 root tty 136, 0 Mar 27 2022 0
- crw--w---- 1 root tty 136, 1 Mar 27 16:38 1
- crw--w---- 1 root tty 136, 2 Mar 27 17:24 2 //新增加的终端
- c--------- 1 root root 5, 2 Jan 5 19:39 ptmx
- //主从关系
[root@ht8 dev]# ls /dev/pt*- /dev/ptmx /dev/pts0
- /dev/pts:
- 0 1 2 ptmx
[root@ht8 pts]# w
17:26:44 up 80 days, 20:48, 3 users, load average: 0.77, 0.65, 0.69
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 10.129.55.19 Sat10 4.00s 0.64s 0.00s w
root pts/1 10.129.55.19 Sat20 48:04 0.04s 0.04s -bash
root pts/2 10.129.55.19 17:24 2:35 0.02s 0.02s -bash
/dev/pts ( pseudo terminal slave) 副虚拟终端,其目录的文件都是由ptmx(主虚拟终端)产生的,它们是父子关系
当一个用户以ssh登录之后,该用户就分到一个ptmx所赋予的pts资源(pts/3),所以说ssh使用的是虚拟终端,不是真正的tty接口。telnet用的则是真正的tty接口。
[root@ht8 tmp]# ps -ef | grep pts //3个终端
root 37445 1377 0 Mar26 ? 00:00:00 sshd: root@pts/0
root 37454 37445 0 Mar26 pts/0 00:00:00 -bash
root 127715 1377 0 Mar26 ? 00:00:00 sshd: root@pts/1
root 127736 127715 0 Mar26 pts/1 00:00:00 -bash
root 53767 1377 0 17:24 ? 00:00:00 sshd: root@pts/2
root 53776 53767 0 17:24 pts/2 00:00:00 -bash
devpts文件系统
- [root@ht8 dev]# df -ha |grep devpts
- devpts 0 0 0 - /dev/pts
- [root@ht8 dev]# mount|column -t | grep devpts
- devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
- //系统支持的文件
- [root@ht8 ~]# cat /proc/filesystems
- nodev sysfs
- nodev rootfs
- nodev ramfs
- nodev bdev
- nodev proc
- nodev cgroup
- nodev cpuset
- nodev tmpfs
- nodev devtmpfs
- nodev debugfs
- nodev securityfs
- nodev sockfs
- nodev dax
- nodev bpf
- nodev pipefs
- nodev configfs
- nodev devpts
- nodev hugetlbfs
- nodev autofs
- nodev pstore
- nodev mqueue
- xfs
- nodev rpc_pipefs
- nodev nfs
- nodev nfs4
- nodev binfmt_misc
- devpts 文件系统加载在 /dev/pts ,命令如下:
- mount devpts /dev/pts -t devpts
- 我们可以使用MAKEDEV来维护这个下面的设备文件,
- MAKEDEV是 一个 脚本程序, 用于 在 /dev 目录下 建立 设备,
- 通过 这些 设备文件可以 访问 位于 内核 的 驱动程序.
- 注意, 如果 应用程序 显示 出错信息 ``ENOENT: No such file or directory'', 一般指 设备文件 不存在, 而
- `ENODEV: No such device'则 表明 内核 没有配置 或 装载 相应的 驱动程序.
5) 伪终端(/dev/pty)
- 这个是终端的发展,为满足现在需求(比如telnet、xwindow窗口的管理)。伪终端(Pseudo Terminal)是成对的逻辑终端设备,
- 例如/dev/ptyp3和/dev/ttyp3(或着在设备文件系统中分别是/dev/pty/m3和/dev/pty/s3)。
- 伪终端用于创建登陆会话或提供其它功能,比如通过 TTY line discipline (包括SLIP或者PPP功能)来处理任意的数据生成。每一个 PTY 都有一个master端和一个slave端。
按照 System V/Unix98 的 PTY 命名方案,所有master端共享同一个 /dev/ptmx 设备节点(打开它内核将自动给出一个未分配的PTY),
所有slave端都位于 /dev/pts 目录下,名为 /dev/pts/# (内核会根据需要自动生成和删除它们)。- 它们与实际物理设备并不直接相关。如果一个程序把ttyp3看作是一个串 行端口设备,则它对该端口的读/写操作会反映在该逻辑终端设备对的另一个上面(ttyp3)。
- 而ttyp3则是 另一个程序用于读写操作的逻辑设备。这样,两个程序就可以通过这种逻辑设备进行互相交流,而其中
- 一个使用ttyp3的程序则认为自己正在与一个串行端口进行通信。这很象是逻辑设备对之间的管道操作。
- 对于ttyp3(s3),任何设计成使用一个串行端口设备的程序都可以使用该逻辑设备。但对于使用ptyp3的
- 程序,则需要专门设计来使用ptyp3(m3)逻辑设备。
- 例如,如果某人在网上使用telnet程序连接到你的计算机上,则telnet程序就可能会开始连接到设
- 备ptyp2(m2)上(一个伪终端端口上)。此时一个getty程序就应该运行在对应的ttyp2(s2)端口上。当telnet从
- 远端获取了一个字符时,该字符就会通过m2、s2传递给getty程序,而getty程序就会通过s2、m2和telnet程序
- 往网络上返回”login:”字符串信息。这样,登录程序与telnet程序就通过“伪终端”进行通信。通过使用适当的
- 软件,就可以把两个甚至多个伪终端设备连接到同一个物理串行端口上。
- 在使用设备文件系统(device filesystem)之前,为了得到大量的伪终端设备特殊文件,HP-UX AIX等使用了
- 比较复杂的文件名命名方式
6)/dev/console
是系统控制终端,系统的错误信息什么的都输出到这里,console是一个缓冲的概念,其实是为内核提供打印的。
我们的pc,终端常用的是显示器和键盘构成,我们用户打印和内核打印都从这个终端反映给用户。所以,这里,/dev/console是连接到/dev/tty0的,
其实这里有2个概念,console和tty这2个咚咚,怎么实现,其实console这个结构中有个device,这里其实就是tty0对应的一个虚拟终端设备。
如果,我们来个专门打印内核的设备(比如通过串口),我们把那个串口register_console,那么/dev/console就到这个串口设备了。
这时,内核打印就到这个串口设备了,而用户的打印还是和上面的/dev/tty相关,如果/dev/tty对应/dev/tty0,那么用户打印还在窗口中出现。
所以说/dev/console是用来外接控制台的。
然后在#dev/pts/0终端中输入echo"test">/dev/pts/0 结果另一个终端上回显示test。
然后你在#dev/pts/0终端中输入echo"test">/dev/tty, 你会发现在当前窗口也显示test字符串。也就是说dev/tty其实就是当前设备文件的一个链接。
关于/dev/console 应该来说更像一个缓冲结果吧,来实现对内核的打印,比如说内核把要打印的内容装入缓冲区,
然后由console来决定打印到哪里吧(比如是tty0还是串口等等吧)。
所以说/dev/console是用来外接控制台的。
- [root@ht8 src]# dmesg | grep tty*
- [ 0.000000] Found optimal setting for mtrr clean up
- [ 0.000000] Setting APIC routing to physical flat.
- [ 0.000000] console [tty0] enabled
- [ 0.137047] MDS: Vulnerable: Clear CPU buffers attempted, no microcode
- [ 0.193221] NMI watchdog: Shutting down hard lockup detector on all cpus
- [ 0.984859] pciehp 0000:00:15.0:pcie004: Slot #160 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.984928] pciehp 0000:00:15.1:pcie004: Slot #161 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.984989] pciehp 0000:00:15.2:pcie004: Slot #162 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985049] pciehp 0000:00:15.3:pcie004: Slot #163 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985109] pciehp 0000:00:15.4:pcie004: Slot #164 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985169] pciehp 0000:00:15.5:pcie004: Slot #165 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985229] pciehp 0000:00:15.6:pcie004: Slot #166 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985291] pciehp 0000:00:15.7:pcie004: Slot #167 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985353] pciehp 0000:00:16.0:pcie004: Slot #192 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985413] pciehp 0000:00:16.1:pcie004: Slot #193 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985475] pciehp 0000:00:16.2:pcie004: Slot #194 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985535] pciehp 0000:00:16.3:pcie004: Slot #195 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985595] pciehp 0000:00:16.4:pcie004: Slot #196 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985660] pciehp 0000:00:16.5:pcie004: Slot #197 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985723] pciehp 0000:00:16.6:pcie004: Slot #198 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985785] pciehp 0000:00:16.7:pcie004: Slot #199 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985846] pciehp 0000:00:17.0:pcie004: Slot #224 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985906] pciehp 0000:00:17.1:pcie004: Slot #225 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.985966] pciehp 0000:00:17.2:pcie004: Slot #226 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.986026] pciehp 0000:00:17.3:pcie004: Slot #227 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.986087] pciehp 0000:00:17.4:pcie004: Slot #228 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.986148] pciehp 0000:00:17.5:pcie004: Slot #229 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.986210] pciehp 0000:00:17.6:pcie004: Slot #230 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.986269] pciehp 0000:00:17.7:pcie004: Slot #231 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.986329] pciehp 0000:00:18.0:pcie004: Slot #256 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.986390] pciehp 0000:00:18.1:pcie004: Slot #257 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.986450] pciehp 0000:00:18.2:pcie004: Slot #258 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.986509] pciehp 0000:00:18.3:pcie004: Slot #259 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.986569] pciehp 0000:00:18.4:pcie004: Slot #260 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.986633] pciehp 0000:00:18.5:pcie004: Slot #261 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.986699] pciehp 0000:00:18.6:pcie004: Slot #262 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.986759] pciehp 0000:00:18.7:pcie004: Slot #263 AttnBtn+ PwrCtrl+ MRL- AttnInd- PwrInd- HotPlug+ Surprise- Interlock- NoCompl+ LLActRep+
- [ 0.987368] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
- [ 0.987372] ACPI: Power Button [PWRF]
- [ 1.001646] rtc_cmos 00:01: setting system clock to 2022-01-05 11:39:26 UTC (1641382766)
- [ 1.361181] mptsas: ioc0: attaching ssp device: fw_channel 0, fw_id 0, phy 0, sas_addr 0x5000c29f91edda54
- [ 1.372502] sd 2:0:0:0: [sda] Attached SCSI disk
- [ 1.483848] sd 0:0:1:0: [sdb] Attached SCSI disk
- [ 1.505423] sr 0:0:0:0: Attached scsi CD-ROM sr0
- [ 1.988570] SGI XFS with ACLs, security attributes, no debug enabled
- [ 12.918105] sd 2:0:0:0: Attached scsi generic sg0 type 0
- [ 12.918163] sr 0:0:0:0: Attached scsi generic sg1 type 5
- [ 12.918218] sd 0:0:1:0: Attached scsi generic sg2 type 0
设备标识会在/proc/devices下
- [root@ht8 src]# cat /proc/devices
- Character devices:
- 4 /dev/vc/0
- 4 tty
- 4 ttyS
- 5 /dev/tty
- 5 /dev/console
- 7 vcs
- 9 st
- 136 pts
- 252 rtc
- 253 dax
- ...
//我们在看下/dev下的有关tty,ttyS
- [root@ht8 src]# ll /dev/
- total 4
- drwxr-xr-x 2 root root 3040 Mar 24 18:17 char
- lrwxrwxrwx 1 root root 15 Jan 5 19:39 stderr -> /proc/self/fd/2
- lrwxrwxrwx 1 root root 15 Jan 5 19:39 stdin -> /proc/self/fd/0
- lrwxrwxrwx 1 root root 15 Jan 5 19:39 stdout -> /proc/self/fd/1
- crw-rw-rw- 1 root tty 5, 0 Jan 5 19:39 tty
- crw--w---- 1 root tty 4, 0 Jan 5 19:39 tty0
- crw--w---- 1 root tty 4, 1 Mar 26 20:59 tty1
- crw--w---- 1 root tty 4, 10 Jan 5 19:39 tty10
- crw--w---- 1 root tty 4, 11 Jan 5 19:39 tty11
- crw--w---- 1 root tty 4, 12 Jan 5 19:39 tty12
- crw--w---- 1 root tty 4, 13 Jan 5 19:39 tty13
- crw--w---- 1 root tty 4, 14 Jan 5 19:39 tty14
- crw--w---- 1 root tty 4, 15 Jan 5 19:39 tty15
- crw--w---- 1 root tty 4, 16 Jan 5 19:39 tty16
- crw--w---- 1 root tty 4, 17 Jan 5 19:39 tty17
- crw--w---- 1 root tty 4, 18 Jan 5 19:39 tty18
- crw--w---- 1 root tty 4, 19 Jan 5 19:39 tty19
- crw--w---- 1 root tty 4, 2 Jan 5 19:39 tty2
- crw--w---- 1 root tty 4, 20 Jan 5 19:39 tty20
- crw--w---- 1 root tty 4, 21 Jan 5 19:39 tty21
- crw--w---- 1 root tty 4, 22 Jan 5 19:39 tty22
- crw--w---- 1 root tty 4, 23 Jan 5 19:39 tty23
- crw--w---- 1 root tty 4, 24 Jan 5 19:39 tty24
- crw--w---- 1 root tty 4, 25 Jan 5 19:39 tty25
- crw--w---- 1 root tty 4, 26 Jan 5 19:39 tty26
- crw--w---- 1 root tty 4, 27 Jan 5 19:39 tty27
- crw--w---- 1 root tty 4, 28 Jan 5 19:39 tty28
- crw--w---- 1 root tty 4, 29 Jan 5 19:39 tty29
- crw--w---- 1 root tty 4, 3 Jan 5 19:39 tty3
- crw--w---- 1 root tty 4, 30 Jan 5 19:39 tty30
- crw--w---- 1 root tty 4, 31 Jan 5 19:39 tty31
- crw--w---- 1 root tty 4, 32 Jan 5 19:39 tty32
- crw--w---- 1 root tty 4, 33 Jan 5 19:39 tty33
- crw--w---- 1 root tty 4, 34 Jan 5 19:39 tty34
- crw--w---- 1 root tty 4, 35 Jan 5 19:39 tty35
- crw--w---- 1 root tty 4, 36 Jan 5 19:39 tty36
- crw--w---- 1 root tty 4, 37 Jan 5 19:39 tty37
- crw--w---- 1 root tty 4, 38 Jan 5 19:39 tty38
- crw--w---- 1 root tty 4, 39 Jan 5 19:39 tty39
- crw--w---- 1 root tty 4, 4 Jan 5 19:39 tty4
- crw--w---- 1 root tty 4, 40 Jan 5 19:39 tty40
- crw--w---- 1 root tty 4, 41 Jan 5 19:39 tty41
- crw--w---- 1 root tty 4, 42 Jan 5 19:39 tty42
- crw--w---- 1 root tty 4, 43 Jan 5 19:39 tty43
- crw--w---- 1 root tty 4, 44 Jan 5 19:39 tty44
- crw--w---- 1 root tty 4, 45 Jan 5 19:39 tty45
- crw--w---- 1 root tty 4, 46 Jan 5 19:39 tty46
- crw--w---- 1 root tty 4, 47 Jan 5 19:39 tty47
- crw--w---- 1 root tty 4, 48 Jan 5 19:39 tty48
- crw--w---- 1 root tty 4, 49 Jan 5 19:39 tty49
- crw--w---- 1 root tty 4, 5 Jan 5 19:39 tty5
- crw--w---- 1 root tty 4, 50 Jan 5 19:39 tty50
- crw--w---- 1 root tty 4, 51 Jan 5 19:39 tty51
- crw--w---- 1 root tty 4, 52 Jan 5 19:39 tty52
- crw--w---- 1 root tty 4, 53 Jan 5 19:39 tty53
- crw--w---- 1 root tty 4, 54 Jan 5 19:39 tty54
- crw--w---- 1 root tty 4, 55 Jan 5 19:39 tty55
- crw--w---- 1 root tty 4, 56 Jan 5 19:39 tty56
- crw--w---- 1 root tty 4, 57 Jan 5 19:39 tty57
- crw--w---- 1 root tty 4, 58 Jan 5 19:39 tty58
- crw--w---- 1 root tty 4, 59 Jan 5 19:39 tty59
- crw--w---- 1 root tty 4, 6 Jan 5 19:39 tty6
- crw--w---- 1 root tty 4, 60 Jan 5 19:39 tty60
- crw--w---- 1 root tty 4, 61 Jan 5 19:39 tty61
- crw--w---- 1 root tty 4, 62 Jan 5 19:39 tty62
- crw--w---- 1 root tty 4, 63 Jan 5 19:39 tty63
- crw--w---- 1 root tty 4, 7 Jan 5 19:39 tty7
- crw--w---- 1 root tty 4, 8 Jan 5 19:39 tty8
- crw--w---- 1 root tty 4, 9 Jan 5 19:39 tty9
- crw-rw---- 1 root dialout 4, 64 Jan 5 19:39 ttyS0
- crw-rw---- 1 root dialout 4, 65 Jan 5 19:39 ttyS1
- crw-rw---- 1 root dialout 4, 66 Jan 5 19:39 ttyS2
- crw-rw---- 1 root dialout 4, 67 Jan 5 19:39 ttyS3
- crw-rw---- 1 root tty 7, 0 Jan 5 19:39 vcs
- crw-rw---- 1 root tty 7, 1 Jan 5 19:39 vcs1
- crw-rw---- 1 root tty 7, 2 Jan 5 19:39 vcs2
- crw-rw---- 1 root tty 7, 3 Jan 5 19:39 vcs3
- crw-rw---- 1 root tty 7, 4 Jan 5 19:39 vcs4
- crw-rw---- 1 root tty 7, 5 Jan 5 19:39 vcs5
- crw-rw---- 1 root tty 7, 6 Jan 5 19:39 vcs6
- crw-rw---- 1 root tty 7, 128 Jan 5 19:39 vcsa
- crw-rw---- 1 root tty 7, 129 Jan 5 19:39 vcsa1
- crw-rw---- 1 root tty 7, 130 Jan 5 19:39 vcsa2
- crw-rw---- 1 root tty 7, 131 Jan 5 19:39 vcsa3
- crw-rw---- 1 root tty 7, 132 Jan 5 19:39 vcsa4
- crw-rw---- 1 root tty 7, 133 Jan 5 19:39 vcsa5
- crw-rw---- 1 root tty 7, 134 Jan 5 19:39 vcsa6
//
- //图形的VCS(“虚控制台屏幕”)VCSA的装置和(“具有属性虚拟控制台屏幕”)
- 例如
/dev/vcs1
和/dev/vcsa1
。的虚拟控制台可以在文件中被配置/etc/inittab
读取由INIT -通常它启动几个虚拟控制台的文本模式登录过程getty。
linux – tty,ttyS,pts,ptmx,vcs,vcsa设备文件之间的区别?(/dev/tty等)的更多相关文章
- [fw]Linux下tty/pty/pts/ptmx详解
基本概念: 1> tty(终端设备的统称):tty一词源于Teletypes,或者teletypewriters,原来指的是电传打字机,是通过串行线用打印机键盘通过阅读和发送信息的东西,后来这东 ...
- Linux Shell脚本入门--(linux空设备文件和重定向)>/dev/null 2>&1
linux空设备文件和重定向 输出/输入重导向 > >> < << :> &> 2&> 2< ...
- LINUX中块设备文件和字符设备文件的本质区别
在LINUX系统文件类型分类的文章中我们提到了 块设备 和 字符设备文件,那么什么是块设备 字符设备文件呢?他们之间有什么本质上的区别呢? 设备文件分为 Block(块) Device Driver ...
- Linux文件描述符与打开文件之间的区别(转载)
转载请说明出处:http://blog.csdn.net/cywosp/article/details/38965239 1. 概述 在Linux系统中一切皆可以看成是文件,文件又可分为: ...
- (转载)linux中设备文件配置程序udev详解
如果你使用Linux比较长时间了,那你就知道,在对待设备文件这块,Linux改变了几次策略.在Linux早期,设备文件仅仅是是一些带有适当的属性集的普通文件,它由mknod命令创建,文件存放在/dev ...
- (转载)使用 udev 高效、动态地管理 Linux 设备文件
概述: Linux 用户常常会很难鉴别同一类型的设备名,比如 eth0, eth1, sda, sdb 等等.通过观察这些设备的内核设备名称,用户通常能知道这些是什么类型的设备,但是不知道哪一个设备是 ...
- 嵌入式 使用udev高效、动态地管理Linux 设备文件
本文以通俗的方法阐述 udev 及相关术语的概念.udev 的配置文件和规则文件,然后以 Red Hat Enterprise Server 为平台演示一些管理设备文件和查询设备信息的实例.本文会使那 ...
- 【转】使用 udev 高效、动态地管理 Linux 设备文件
简介: 本文以通俗的方法阐述 udev 及相关术语的概念.udev 的配置文件和规则文件,然后以 Red Hat Enterprise Server 为平台演示一些管理设备文件和查询设备信息的实例.本 ...
- Linux学习之CentOS(六)---mount挂载设备(u盘,光盘,iso等 )
对于新手学习,mount 命令,一定会有很多疑问.其实我想疑问来源更多的是对linux系统本身特殊性了解问题. linux是基于文件系统,所有的设备都会对应于:/dev/下面的设备.如: [cheng ...
随机推荐
- CF877F题解
题目大意 有一个序列,每个位置上有 \(1\) 或 \(2\) 两种元素若干,每次询问一个区间,求这个区间有多少个子区间满足 \(1\) 类元素恰好比 \(2\) 类元素多 \(k\) 个. 莫队 要 ...
- 拉普拉斯特征映射(Laplacian Eigenmaps)
1 介绍 拉普拉斯特征映射(Laplacian Eigenmaps)是一种不太常见的降维算法,它看问题的角度和常见的降维算法不太相同,是从局部的角度去构建数据之间的关系.也许这样讲有些抽象,具体来讲, ...
- chap8-fluent python
浅拷贝 VS 深拷贝 # In[] # list 生成一个新的引用对象,只是用alst完成初始化 alst = [1,2,3,4,5] blst=list(alst) alst.append(6) p ...
- 线程池的极简用法——内置线程池multiprocessing
大家好,今天博主来分享一个线程池的小捷径--内置线程池的使用方法 一.背景 说道多线程,对变成层有了解的小伙伴一定不陌生,虽然不知道是什么但是也会从各大网站.面试分享等途径听说过.这里就不做过多的介绍 ...
- 程序设计基础·Java学习笔记·面向对象(上)
Java程序设计基础之面向对象(上) (自适应学习进度而进行记录的笔记,希望有一些小小的用处吧(^∀^●)ノシ) (新人上路,望多指教,如有错误,望指正,万分感谢(o゚v゚)ノ) 目录 一.面向对象 ...
- springWeb——Servlet
6.1.Servlet简介 servlet是sun公司开发动态web的一门技术 sum在这些API中提供了一个接口叫做:Servlet.开发的两个步骤: 编写一个类,实现Servlet接口 把开发好的 ...
- windows服务器怎么将证书添加到受信任证书颁发机构
1.键盘输入win+r 快键键,出现运行,输入mmc. 2.打开控制台根节点,点击上方导航栏的文件-->添加删除管理单元.如下图. 3.在可用的管理单元中选择"证书",计算机 ...
- 内网渗透----windows信息收集整理
一.基础信息收集 1.信息收集类型 操作系统版本.内核.架构 是否在虚拟化环境中,已安装的程序.补丁 网络配置及连接 防火墙设置 用户信息.历史纪录(浏览器.登陆密码) 共享信息.敏感文件.缓存信息. ...
- 盘点几种DIY加密狗的制作方法,适用于穿越机模拟器
前言 前几天笔者的加密狗在使用中突然坏掉了,现象是插电脑不识别,LED灯不亮. 网上很多模友也反映了同样的问题: http://bbs.5imx.com/forum.php?mod=viewthrea ...
- Flutter入门教程(一)Flutter简介
这是Flutter系列第一篇文章,后续会持续更新Flutter相关知识,本篇就主要对于Flutter技术做一个简单的入门介绍 一.Flutter简介 Flutter是谷歌的移动UI框架,可以快速在iO ...