Linux的终端类型

1、串行端口终端(/dev/ttySn):  

    串行端口终端(Serial Port Terminal)是使用计算机串行端口连接的终端设备。计算机把每个串行端口都看作是一个字符设备。有段时间这些串行端口设备通常被称为终端设备,因为那时它的最大用途就是用来连接终端。这些串行端口所对应的设备名称是/dev/tts/0(或/dev/ttyS0), /dev/tts/1(或/dev/ttyS1)等,设备号分别是(4,0), (4,1)等,分别对应于DOS系统下的COM1、COM2等。若要向一个端口发送数据,可以在命令行上把标准输出重定向到这些特殊文件名上即可。

2、伪终端(/dev/pty):

    所谓伪终端是逻辑上的终端设备,多用于模拟终端程序。例如我们在Windows使用telnet或ssh等方式登录Linux主机,此时均在使用pty设备。

    pty即Pseudo-TTY 伪终端或者叫做虚拟终端。是成对的逻辑终端设备(即master和slave设备, 对master的操作会反映到slave上)。

    pts是Pseudo Terminal Slave的缩写。是pty的实现方法,与ptmx(pseudo-terminal master)配合使用实现pty。当我们telnet到主机,或者直接使用xterm,或者程序需要交互时,我们就需要一个终端。因为只有通过终端我们才能实现人与计算机的交互。只要是人与计算机的交互,就一定是使用的虚拟终端pty(pseudo-tty)。

[pirate@localhost ~]$ ll /dev/pts/*
crw--w----. 1 pirate tty  136, 0 Oct 13 08:14 /dev/pts/0
crw--w----. 1 pirate tty  136, 1 Oct 13 08:14 /dev/pts/1
crw--w----. 1 pirate tty  136, 3 Oct 12 15:50 /dev/pts/3
c---------. 1 root   root   5, 2 Oct 12 11:12 /dev/pts/ptmx
[pirate@localhost ~]$ tty      #xshell中查看当前pts
/dev/pts/1
[pirate@localhost ~]$ tty      #xwindow中查看当前pts
/dev/pts/0

3、控制台终端/物理终端( /dev/console)

    在Linux 系统中,计算机显示器通常被称为控制台终端(Console)。

4、虚拟终端(/dev/tty# [#为1-6])   

    tty一词源于Teletypes,或teletypewriters,原来指的是电传打字机,是通过串行线用打印机键盘通过阅读和发送信息的东西,后来这东西被键盘和显示器取代,所以现在叫终端比较合适。终端是一种字符型设备,他有多种类型,通常使用tty来简称各种类型的终端设备。

    切换方式为Ctrl+Alt+F[1-6]。

[pirate@localhost ~]$ ll /dev/tty*
crw-rw-rw-. 1 root   tty     5,  0 Oct 12 11:12 /dev/tty
crw--w----. 1 root   tty     4,  0 Oct 12 11:12 /dev/tty0
crw--w----. 1 root   tty     4,  1 Oct 12 11:12 /dev/tty1
crw--w----. 1 root   tty     4, 10 Oct 12 11:12 /dev/tty10
crw--w----. 1 root   tty     4, 11 Oct 12 11:12 /dev/tty11
crw--w----. 1 root   tty     4, 12 Oct 12 11:12 /dev/tty12
crw--w----. 1 root   tty     4, 13 Oct 12 11:12 /dev/tty13
crw--w----. 1 root   tty     4, 14 Oct 12 11:12 /dev/tty14
crw--w----. 1 root   tty     4, 15 Oct 12 11:12 /dev/tty15
crw--w----. 1 root   tty     4, 16 Oct 12 11:12 /dev/tty16
crw--w----. 1 root   tty     4, 17 Oct 12 11:12 /dev/tty17
crw--w----. 1 root   tty     4, 18 Oct 12 11:12 /dev/tty18
crw--w----. 1 root   tty     4, 19 Oct 12 11:12 /dev/tty19
crw--w----. 1 pirate tty     4,  2 Oct 12 15:50 /dev/tty2
crw--w----. 1 root   tty     4, 20 Oct 12 11:12 /dev/tty20
crw--w----. 1 root   tty     4, 21 Oct 12 11:12 /dev/tty21
crw--w----. 1 root   tty     4, 22 Oct 12 11:12 /dev/tty22
crw--w----. 1 root   tty     4, 23 Oct 12 11:12 /dev/tty23
crw--w----. 1 root   tty     4, 24 Oct 12 11:12 /dev/tty24
crw--w----. 1 root   tty     4, 25 Oct 12 11:12 /dev/tty25
crw--w----. 1 root   tty     4, 26 Oct 12 11:12 /dev/tty26
crw--w----. 1 root   tty     4, 27 Oct 12 11:12 /dev/tty27
crw--w----. 1 root   tty     4, 28 Oct 12 11:12 /dev/tty28
crw--w----. 1 root   tty     4, 29 Oct 12 11:12 /dev/tty29
crw--w----. 1 root   tty     4,  3 Oct 12 11:12 /dev/tty3
crw--w----. 1 root   tty     4, 30 Oct 12 11:12 /dev/tty30
crw--w----. 1 root   tty     4, 31 Oct 12 11:12 /dev/tty31
crw--w----. 1 root   tty     4, 32 Oct 12 11:12 /dev/tty32
crw--w----. 1 root   tty     4, 33 Oct 12 11:12 /dev/tty33
crw--w----. 1 root   tty     4, 34 Oct 12 11:12 /dev/tty34
crw--w----. 1 root   tty     4, 35 Oct 12 11:12 /dev/tty35
crw--w----. 1 root   tty     4, 36 Oct 12 11:12 /dev/tty36
crw--w----. 1 root   tty     4, 37 Oct 12 11:12 /dev/tty37
crw--w----. 1 root   tty     4, 38 Oct 12 11:12 /dev/tty38
crw--w----. 1 root   tty     4, 39 Oct 12 11:12 /dev/tty39
crw--w----. 1 root   tty     4,  4 Oct 12 11:12 /dev/tty4
crw--w----. 1 root   tty     4, 40 Oct 12 11:12 /dev/tty40
crw--w----. 1 root   tty     4, 41 Oct 12 11:12 /dev/tty41
crw--w----. 1 root   tty     4, 42 Oct 12 11:12 /dev/tty42
crw--w----. 1 root   tty     4, 43 Oct 12 11:12 /dev/tty43
crw--w----. 1 root   tty     4, 44 Oct 12 11:12 /dev/tty44
crw--w----. 1 root   tty     4, 45 Oct 12 11:12 /dev/tty45
crw--w----. 1 root   tty     4, 46 Oct 12 11:12 /dev/tty46
crw--w----. 1 root   tty     4, 47 Oct 12 11:12 /dev/tty47
crw--w----. 1 root   tty     4, 48 Oct 12 11:12 /dev/tty48
crw--w----. 1 root   tty     4, 49 Oct 12 11:12 /dev/tty49
crw--w----. 1 root   tty     4,  5 Oct 12 11:12 /dev/tty5
crw--w----. 1 root   tty     4, 50 Oct 12 11:12 /dev/tty50
crw--w----. 1 root   tty     4, 51 Oct 12 11:12 /dev/tty51
crw--w----. 1 root   tty     4, 52 Oct 12 11:12 /dev/tty52
crw--w----. 1 root   tty     4, 53 Oct 12 11:12 /dev/tty53
crw--w----. 1 root   tty     4, 54 Oct 12 11:12 /dev/tty54
crw--w----. 1 root   tty     4, 55 Oct 12 11:12 /dev/tty55
crw--w----. 1 root   tty     4, 56 Oct 12 11:12 /dev/tty56
crw--w----. 1 root   tty     4, 57 Oct 12 11:12 /dev/tty57
crw--w----. 1 root   tty     4, 58 Oct 12 11:12 /dev/tty58
crw--w----. 1 root   tty     4, 59 Oct 12 11:12 /dev/tty59
crw--w----. 1 root   tty     4,  6 Oct 12 11:12 /dev/tty6
crw--w----. 1 root   tty     4, 60 Oct 12 11:12 /dev/tty60
crw--w----. 1 root   tty     4, 61 Oct 12 11:12 /dev/tty61
crw--w----. 1 root   tty     4, 62 Oct 12 11:12 /dev/tty62
crw--w----. 1 root   tty     4, 63 Oct 12 11:12 /dev/tty63
crw--w----. 1 root   tty     4,  7 Oct 12 11:12 /dev/tty7
crw--w----. 1 root   tty     4,  8 Oct 12 11:12 /dev/tty8
crw--w----. 1 root   tty     4,  9 Oct 12 11:12 /dev/tty9
crw-rw----. 1 root   dialout 4, 64 Oct 12 11:12 /dev/ttyS0
crw-rw----. 1 root   dialout 4, 65 Oct 12 11:12 /dev/ttyS1
crw-rw----. 1 root   dialout 4, 66 Oct 12 11:12 /dev/ttyS2
crw-rw----. 1 root   dialout 4, 67 Oct 12 11:12 /dev/ttyS3
[pirate@localhost ~]$ tty    #查看当前tty
/dev/tty3

    

原创文章,作者:wangshuai,如若转载,请注明出处:http://www.178linux.com/50913

(0)
wangshuaiwangshuai
上一篇 2016-10-14 11:40
下一篇 2016-10-14 11:41

相关推荐

  • MBR分区结构

    MBR分区结构 一、硬盘主引导记录MBR由4个部分组成: 1、主引导程序(偏移地址0000H–0088H),它负责从活动分区中装载,并运行系统引导程序。 2、出错信息数据区,偏移地址0089H–00E1H为出错信息,00E2H–01BDH全为0字节。 3、分区表(DPT,Disk Partition Table):含4个分…

    2017-08-20
  • 链接分析算法之:主题敏感PageRank

      前面的讨论提到。PageRank忽略了主题相关性,导致结果的相关性和主题性降低,对于不同的用户,甚至有很大的差别。例如,当搜索“苹果”时,一个数码爱好者可能是想要看 iphone 的信息,一个果农可能是想看苹果的价格走势和种植技巧,而一个小朋友可能在找苹果的简笔画。理想情况下,应该为每个用户维护一套专用向量,但面对海量用户这种方法显然不可行。所…

    Linux干货 2016-02-17
  • linux网络命令与软件管理

    1、描述网桥、集线器、二层交换机、三层交换机、路由器的功能、使用场景和区别 网桥也叫桥接器,是连接两个局域网的一种存储/转发设备,用来连接不同网段。 集线器称为“Hub”,主要功能是对接收到的信号进行再生整形放大,以扩大网络的传输距离,同时把所有节点集中在以它为中心的节点上。 二层交换机工作于OSI模型的第2层(数据链路层),可识别数据包中的MAC地址信息,…

    Linux干货 2016-12-18
  • 【福利招聘】 Base 上海 拍拍货(红杉领投,靠谱金融公司) 共5人

    公司简介 拍拍贷成立于2007年6月,全称为“上海拍拍贷金融信息服务有限公司”,总部位于国际金融中心上海,是中国首批网络信息借贷平台。 拍拍贷是一家由工商部门特批,获批“金融信息服务”的经营范围,得到政府认可的互联网金融平台。拍拍贷用先进的理念和创新的技术建立一个安全、高效、透明的互联网金融平台,规范个人贷款行为,让借入这改善生产生活,让借出者增加投资渠道。…

    Linux干货 2016-12-05
  • N24 第三周 磁盘及文件系统管理

    Linux系统管理          磁盘分区及文件系统管理          RAID          LVM 动态磁盘设备管理          网络属性…

    Linux干货 2016-11-22
  • 常用文本处理命令练习

    1、列出当前系统上所有已经登录的的用户的用户名,注意同一用户登录多次,则只显示一次 [root@keyou ~]#  w -hs | cut -d' ' -f 1 | sort -u  gentoo …

    系统运维 2016-11-13