{"id":111219,"date":"2024-12-02T22:47:10","date_gmt":"2024-12-02T14:47:10","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=111219"},"modified":"2024-12-02T22:47:10","modified_gmt":"2024-12-02T14:47:10","slug":"linux-terminal","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-terminal.html","title":{"rendered":"linux\u7ec8\u7aef\u6982\u89c8"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u4f7f\u7528Linux\u7ec8\u7aef\u4e0d\u4ec5\u4ec5\u662f\u53ea\u8f93\u5165\u547d\u4ee4\u3002\u5b66\u4e60\u8fd9\u4e9b\u57fa\u672c\u7684\u6280\u5de7\uff0c\u4f60\u5c31\u4f1a\u9010\u6e10\u638c\u63e1Bash shell\uff0c\u8fd9\u4e2a\u5728\u5927\u591a\u6570Linux\u53d1\u884c\u7248\u4e0a\u9ed8\u8ba4\u4f7f\u7528\u7684\u7ec8\u7aef\u5de5\u5177\u3002\u8fd9\u7bc7\u6587\u7ae0\u662f\u5199\u7ed9\u7f3a\u4e4f\u7ecf\u9a8c\u7684\u65b0\u624b\u7684\uff0c\u6211\u76f8\u4fe1\u5927\u591a\u6570\u9ad8\u7ea7\u7528\u6237\u5df2\u7ecf\u77e5\u9053\u4e86\u6240\u6709\u7684\u8fd9\u4e9b\u6280\u5de7\u3002\u4f46\u662f\uff0c\u4f60\u4ecd\u7136\u53ef\u4ee5\u770b\u770b\uff0c\u4e5f\u8bb8\u80fd\u5b66\u5230\u4f60\u4e00\u76f4\u4ee5\u6765\u90fd\u5ffd\u7565\u4e86\u7684\u4e1c\u897f\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n <\/p>\n Linux\u7ec8\u7aef\uff1a<\/strong><\/div>\n \u5728Linux\u7cfb\u7edf\u7684\u8bbe\u5907\u7279\u6b8a\u6587\u4ef6\u76ee\u5f55\/dev\/\u4e0b\uff0c\u7ec8\u7aef\u7279\u6b8a\u8bbe\u5907\u6587\u4ef6\u4e00\u822c\u6709\u4ee5\u4e0b\u51e0\u79cd\uff1a<\/p>\n 1\u3001\u4e32\u884c\u7aef\u53e3\u7ec8\u7aef(\/dev\/ttySn)<\/strong><\/div>\n \u4e32\u884c\u7aef\u53e3\u7ec8\u7aef(Serial Port Terminal)\u662f\u4f7f\u7528\u8ba1\u7b97\u673a\u4e32\u884c\u7aef\u53e3\u8fde\u63a5\u7684\u7ec8\u7aef\u8bbe\u5907\u3002\u8ba1\u7b97\u673a\u628a\u6bcf\u4e2a\u4e32\u884c\u7aef\u53e3\u90fd\u770b\u4f5c\u662f\u4e00\u4e2a\u5b57\u7b26\u8bbe\u5907\u3002 \u82e5\u8981\u5411\u4e00\u4e2a\u7aef\u53e3\u53d1\u9001\u6570\u636e\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e0a\u628a\u6807\u51c6\u8f93\u51fa\u91cd\u5b9a\u5411\u5230\u8fd9\u4e9b\u7279\u6b8a\u6587\u4ef6\u540d\u4e0a\u5373\u53ef\uff01\uff01\uff01\uff01 2\u3001\u4f2a\u7ec8\u7aef(\/dev\/pty\/)<\/strong><\/div>\n \u4f2a\u7ec8\u7aef(Pseudo Terminal)\u662f\u6210\u5bf9\u7684\u903b\u8f91\u7ec8\u7aef\u8bbe\u5907(\u5373master\u548cslave\u8bbe\u5907, \u5bf9master\u7684\u64cd\u4f5c\u4f1a\u53cd\u6620\u5230slave\u4e0a)\u3002 \u5982\u679c\u4e00\u4e2a\u7a0b\u5e8f\u628aptyp3(master\u8bbe\u5907)\u770b\u4f5c\u662f\u4e00\u4e2a\u4e32\u884c\u7aef\u53e3\u8bbe\u5907\uff0c\u5219\u5b83\u5bf9\u8be5\u7aef\u53e3\u7684\u8bfb\/\u5199\u64cd\u4f5c\u4f1a\u53cd\u6620\u5728\u8be5\u903b\u8f91\u7ec8\u7aef\u8bbe\u5907\u5bf9\u5e94\u7684\u53e6\u4e00\u4e2attyp3(slave\u8bbe\u5907)\u4e0a\u9762\u3002 \u8fd9\u6837\uff0c\u4e24\u4e2a\u7a0b\u5e8f\u5c31\u53ef\u4ee5\u901a\u8fc7\u8fd9\u79cd\u903b\u8f91\u8bbe\u5907\u8fdb\u884c\u4e92\u76f8\u4ea4\u6d41\uff0c\u800c\u5176\u4e2d\u4e00\u4e2a\u4f7f\u7528ttyp3\u7684\u7a0b\u5e8f\u5219\u8ba4\u4e3a\u81ea\u5df1\u6b63\u5728\u4e0e\u4e00\u4e2a\u4e32\u884c\u7aef\u53e3\u8fdb\u884c\u901a\u4fe1\u3002\u8fd9\u5f88\u8c61\u662f\u903b\u8f91\u8bbe\u5907\u5bf9\u4e4b\u95f4\u7684\u7ba1\u9053\u64cd\u4f5c\u3002\u5bf9\u4e8ettyp3(s3)\uff0c\u4efb\u4f55\u8bbe\u8ba1\u6210\u4f7f\u7528\u4e00\u4e2a\u4e32\u884c\u7aef\u53e3\u8bbe\u5907\u7684\u7a0b\u5e8f\u90fd\u53ef\u4ee5\u4f7f\u7528\u8be5\u903b\u8f91\u8bbe\u5907\u3002\u4f46\u5bf9\u4e8e\u4f7f\u7528ptyp3\u7684\u7a0b\u5e8f\uff0c\u5219\u9700\u8981\u4e13\u95e8\u8bbe\u8ba1\u6765\u4f7f\u7528 ptyp3(m3)\u903b\u8f91\u8bbe\u5907\u3002<\/p>\n \u4f8b\u5982\uff0c\u5982\u679c\u67d0\u4eba\u5728\u7f51\u4e0a\u4f7f\u7528telnet\u7a0b\u5e8f\u8fde\u63a5\u5230\u4f60\u7684\u8ba1\u7b97\u673a\u4e0a\uff0c\u5219telnet\u7a0b\u5e8f\u5c31\u53ef\u80fd\u4f1a\u5f00\u59cb\u8fde\u63a5\u5230\u8bbe\u5907 ptyp2(m2)\u4e0a(\u4e00\u4e2a\u4f2a\u7ec8\u7aef\u7aef\u53e3\u4e0a)\u3002 \u5728\u4f7f\u7528\u8bbe\u5907\u6587\u4ef6\u7cfb\u7edf (device filesystem)\u4e4b\u524d\uff0c\u4e3a\u4e86\u5f97\u5230\u5927\u91cf\u7684\u4f2a\u7ec8\u7aef\u8bbe\u5907\u7279\u6b8a\u6587\u4ef6\uff0c\u4f7f\u7528\u4e86\u6bd4\u8f83\u590d\u6742\u7684\u6587\u4ef6\u540d\u547d\u540d\u65b9\u5f0f\u3002\u56e0\u4e3a\u53ea\u5b58\u572816\u4e2attyp(ttyp0\u2014ttypf) \u7684\u8bbe\u5907\u6587\u4ef6\uff0c\u4e3a\u4e86\u5f97\u5230\u66f4\u591a\u7684\u903b\u8f91\u8bbe\u5907\u5bf9\uff0c\u5c31\u4f7f\u7528\u4e86\u8c61q\u3001r\u3001s\u7b49\u5b57\u7b26\u6765\u4ee3\u66ffp\u3002<\/p>\n \u4f8b\u5982\uff0cttys8\u548cptys8\u5c31\u662f\u4e00\u4e2a\u4f2a\u7ec8\u7aef\u8bbe\u5907\u5bf9\u3002 \u76ee\u5f55 \/dev\/pts\u662f\u4e00\u4e2a\u7c7b\u578b\u4e3adevpts\u7684\u6587\u4ef6\u7cfb\u7edf\uff0c\u5e76\u4e14\u53ef\u4ee5\u5728\u88ab\u52a0\u8f7d\u6587\u4ef6\u7cfb\u7edf\u5217\u8868\u4e2d\u770b\u5230\u3002\u867d\u7136\u201c\u6587\u4ef6\u201d\/dev\/pts\/3\u770b\u4e0a\u53bb\u662f\u8bbe\u5907\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4e00\u9879\uff0c\u4f46\u5176\u5b9e\u5b83\u5b8c\u5168\u662f\u4e00\u79cd\u4e0d\u540c\u7684\u6587\u4ef6\u7cfb\u7edf\u3002 TELNET \u2014> TTYP3(S3: slave) \u2014> PTYP3(M3: master) \u2014> GETTY<\/pre>\n |