4 ms·
Ctrl-D means "End of transmission", which is appropriate to exit a program which expects to receive input. A process monitor like top isn't oriented toward inpu
by quesera 4y ago
Ctrl-D means "End of transmission", which is appropriate to exit a program which expects to receive input. A process monitor like top isn't oriented toward input, particularly, so I would not expect Ctrl-D to do anything. And it does not.
By the way, Ctrl-D does not close the terminal either. It tells the shell that you're finished sending input, which means it has no more work to do and should exit. If you have jobs running in the background, it will warn you first (default config). If the shell exits, and it was the only thing running in the terminal, the terminal may then decide to close itself. Some do, some do not.
Back to Ctrl-C though, using your example of top as a screen-oriented program: when you press Ctrl-C in top, it interprets the input as Interrupt, and ... exits! Just like a user in a terminal environment would expect. :)
- fnordpiglet 4y agoYes, I’m aware of what it does. But do you have any screen oriented programs that treats ^D as a signal to close stdin? You are right, it does exit on ^C. I picked it as an example of something that seems compliant but doesn’t actually behave like a line oriented program as a screen oriented program.
- quesera 4y ago> But do you have any screen oriented programs that treats ^D as a signal to close stdin? stdin is a different thing in a screen-oriented program than a line-oriented one, yes. Screen-oriented typically operates on characters not strings, roughly. Closing stdin in a screen-oriented program doesn't really have a meaningful interpretation. But if you'd like an example of a screen-oriented program that exits on Ctrl-D, I can offer musikcube. Not very well-known perhaps (though it's a great music player), and to be fair I consider the Ctrl-D behavior to be a UX oddity, however harmless.