Mac的Terminal的窗口,"ttys000"是什麼意思?背後有什麼故事么?
如圖:
題主每次打開Terminal的時候,其實都有這個疑問~_~,終於憋不住了,提出了這個問題,題主能wiki到的是 TTY 但是,貌似然並卵。希望知道的人士解釋一二,如果背後有什麼歷史淵源,也請略說一二。
剛剛注意到這個字元串。。。玩了之後就來分享一記(話說,這個應該叫Terminal吧?)
勾選TTY名稱試驗一下就可以看到結果了。簡單地說ttys000就是TTY名稱。TTY的來源應該就是題主看到的那樣。
getty (Unix)
From Wikipedia, the free encyclopediagetty (Unix)getty (Unix)gettyWritten inCOperating systemUNIX / LinuxLicenseVariousgetty, short for "get tty", is a Unix program running on a host computer that manages physical or virtual terminals (TTYs). When it detects a connection, it prompts for a username and runs the login program to authenticate the user.
Originally, on traditional Unix systems, getty handled connections to serial terminals (often teletype machines) connected to a host computer. The tty part of the name stands for teletype, but has come to mean any type of text terminal. One gettyprocess serves one terminal. In some systems, for example, Solaris, getty was replaced by ttymon.
Personal computers running Unix-likeoperating systems, even if they do not provide any remote login services, may still use getty as a means of logging in on a local virtual console. Getty is a core component in systemd, which many Linux distributions use.
[1]
Cycling through the ttys can be done by the key combination [Ctrl]+[Alt]+[F1] to [F6].
[2]
The key combination Ctrl+D can often be used to terminate a tty.
[3]
Starting X from the command-line style tty can be done by means of the command "startx".
Instead of the login program, getty may also be set up by the system administrator to run any other program, for example pppd (point-to-point protocoldaemon) to provide a dial-up Internet connection.
可以多cmd+N幾個試試。
綜合起來看,最早應該是指電傳打字機Teletypes,曾是唯一能被實時使用的輸入/輸出設備,而後被鍵盤和顯示器終端取代,但是名字卻保留下來,通過改變後面的編號,在MAC OS X中用於區分不同的Terminal(可以各自處理不同的進程)。沒找到最多可以開的窗口數。我開了100多個沒什麼壓力。前面最後一張圖就是ctrl+D的結果,關於terminate a tty。tty在Linux系統開發中似乎更接近它的本意。計算機方面這種名詞意義發生改變的例子挺多的,還挺好玩的哈哈
此處省略一系列奇怪的操作……發現126似乎是上限(也許只是對於我的電腦目前可用的資源而言)。突然發現我的ttys就變成從001開始計數了。超過上限時,新建的窗口如下:退出會異常,重新打開還是滿屏的窗口,會出現「[恢復於 *年*月*日 下午*:*:*]」之類的字樣.好吧我承認我很無聊地調戲了自己的電腦。怎麼我玩了這麼久還沒下載完100M的文件T_T簡單來說,這是一個歷史問題。
tty 是 TeleTYpe 電傳打字機的縮寫(不要問我這鬼異的縮寫)。在當年,電傳打字機是唯一能夠被使用的實時輸入輸出設備。隨著歷史那麼那麼的發展,電傳打字機被終端所取代。但是(但是前面的都是廢話),操作系統仍要一個程序來監視串列埠,一個getty「Get TTY」的處理過程是:一個程序監視物理的TTY/終端介面。記得 IPN 的內核恐慌談論過。給出鏈接且來個百度百科的鏈接。
參考資料:內核恐慌 #29: Terminal EmulatorsThe TTY demystifiedTTY_百度百科推薦閱讀: