TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Anatomy of a terminal emulator (2021)

93 点作者 alex_hirner大约 3 年前

9 条评论

dang大约 3 年前
<i>Anatomy of a Terminal Emulator</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29080561" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29080561</a> - Nov 2021 (70 comments)
deathanatos大约 3 年前
&gt; <i>The new process [ls -l] gets the desired data, sends it to the shell and terminates.</i><p>&gt; <i>The shell sends the data to the terminal through the STDOUT side of the pty</i><p>Unless redirected, ls inherits the pty file descriptor from the shell¹ when the shell forks it. But after that, it&#x27;s writing to the terminal emulator directly, not to the shell; that is, the shell doesn&#x27;t forward `ls -l`&#x27;s output to the terminal.<p>¹(or really, the child inherits whatever file descriptor the shell has for stdin, stdout, stderr for its stdin, stdout, stderr, respectively, unless, for each of those, there is a redirection specified, in which case the shell replaces the file descriptor in the child as specified by the command give to the shell. stdin&#x2F;stdout&#x2F;stderr might be a pty in the shell, or they might not be.)
评论 #30481164 未加载
westoncb大约 3 年前
It&#x27;s kind of incredible that after ~20 years of programming I&#x27;d never come across anything illuminating this breakdown:<p>&gt; The terminal emulator is a graphical application whose role it is to interpret data coming from the shell and display it on screen. This display is often textual but not always.<p>&gt; The shell provides an interface to the operating system, allowing the user to interact with its file-system, run processes and often have access to basic scripting capabilities.<p>&gt; These two programs are connected together by the pty (pseudoterminal) which provides a bi-directional asynchronous communication channel between the two.
评论 #30481432 未加载
georgia_peach大约 3 年前
An excellent article in his &quot;Further Reading&quot; section:<p><a href="https:&#x2F;&#x2F;www.linusakesson.net&#x2F;programming&#x2F;tty&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.linusakesson.net&#x2F;programming&#x2F;tty&#x2F;</a>
atarian大约 3 年前
Interesting I didn&#x27;t know that terminal sessions were files. So if I was root on a shared host, I could theoretically hijack and listen to what other people are doing in their SSH sessions.
评论 #30480503 未加载
评论 #30481337 未加载
eterps大约 3 年前
Wow, high quality blog post.
danellis大约 3 年前
I was surprised by the assumption of ANSI and no mention of $TERM.
评论 #30481283 未加载
nothrowaways大约 3 年前
Cool domain.
评论 #30480948 未加载
georgia_peach大约 3 年前
I feel this is the only article distinguishing this place from CNN at the moment.