
Initially I was supposed to write another article on something completely different, but then I randomly found myself digging into what CTRL+D actually does on Linux. And it turned out it does something different than I thought, so I decided to share my surprise in the form of an article posted at hackArcana. Here's the first section:
Linux Terminal: CTRL+D is like pressing ENTER
What I always thought—and I'm pretty sure I'm not alone in this—was that pressing CTRL+D in the terminal closes the standard input for the running process. Alternatively, I've heard that CTRL+D sends an "EOF signal" to the application. But if you actually think about it, it just doesn't make sense. After all, in Bash you can press CTRL+D if the line isn't empty, and nothing happens! Perhaps that's a terminal setting then which Bash changes? Or maybe something more, or—as is in this case—something less is going on. Let's investigate!
Somebody's wrong on the Internet
Apart from the correct answer—to which we'll get shortly—there are two lead answers on "what does CTRL+D in a terminal do" that can be found on the Internet. Both wrong.
- It sends an EOF (End-of-File) signal/marker/character to the running program.
- It closes the standard input of the running program.
The first answer is somewhat correct (we'll get to that later), but not in the way you think.
Continue at hackArcana...
Add a comment: