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.www58058.com/50913

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

相關推薦

  • rpm包管理

    rpm包管理 由于 RPM 是透過預先編譯打包成為 RPM 文件格式后,再加以安裝的一種方式,還能夠進行數據庫的記載。 所以 RPM 有以下的優點: RPM 內含已經編譯過的程序與配置文件等數據,可以讓用戶免除重新編譯的困擾; RPM 在被安裝前,會先檢查系統的硬盤容量、操作系統版本等,可避免檔案被錯誤安裝; RPM 檔案本身提供軟件版本信息、相依屬性軟件名…

    Linux干貨 2016-08-21
  • Windows 10 VS. Linux

    原文出處: Linux中國 – zpl1025   前陣子 Windows 10 好像占據了絕大部分頭條,甚至在一些Linux圈里也是一樣。最具代表性的是 betanews.com 的 Brian Fagioli 說 Windows 10 已經為 Linux 桌面系統敲響了喪鐘,Microsoft 如今宣布將為忠實的…

    系統運維 2015-03-24
  • VimTutor中文版

        歡  迎   閱   讀   《 V I M  教  程 》           …

    Linux干貨 2016-08-24
  • 什么叫Linux

    什么叫linux:     Linux是一套免費使用和自由傳播的類Unix操作系統,它主要用于基于Intel x86系列CPU的計算機上。這個系統是由全世界各地的成千上萬的程序員設計和實現的。其目的是建立不受任何商品化軟件的版權制約的、全世界都能自由使用的Unix兼容產品。 誰編寫的linux: Linux的出現,最早…

    Linux干貨 2017-03-27
  • Linux操作系統發展史

    內容摘要:Linux操作系統的誕生,Linux 的發展,Linux的特性決定其迅猛發展,Linux的應用領域與發展前景 關鍵詞:Linux的發展  前景   1.  Linux操作系統的誕生 在1981年到1991年十年間,微軟公司的MS-DOS系統一直主宰操作系統的市場,其價格十分昂貴,另一個操作系統UNIX的經銷商為了高利潤…

    Linux干貨 2016-10-14
  • CentOS7 實現網卡綁定

    Bonding ;理念 將多塊網卡綁定同一IP地址對外提供服務,可以實現高可用 或者負載均衡。直接給兩塊網卡設置同一IP地址是不可以的 。通過bonding,虛擬一塊網卡對外提供連接,物理網卡的 被修改為相同的MAC地址 banding工作模式 Mode 0 (balance-rr) 輪轉(Round-robin)策略: 從頭到尾順序的在每一個slave 接…

    2017-12-19
欧美性久久久久