Is Ctrl+D really like Enter?
Response to a recent claim that Ctrl+D in the terminal is like pressing Enter. It kind of is but it’s also misleading to say so without further explanation.
This entry was edited (1 month ago)
Response to a recent claim that Ctrl+D in the terminal is like pressing Enter. It kind of is but it’s also misleading to say so without further explanation.
pmk
in reply to mina86 • • •mina86
in reply to pmk • • •pmk
in reply to mina86 • • •Found it in the classic The UNIX Programming Environment from 1984:
But then, this is for return, which technically isn't "enter", but nowadays they are sort of interpreted the same by programs?
mina86
in reply to pmk • • •* In graphical applications, Ctrl+M, Ctrl+J and Return/Enter are all different things.
* In a terminal in raw mode, Ctrl+M and Return/Enter are the same thing but Ctrl+J is something different. You can for example run
bind -x '"\C-j":"echo a"'
in bash and Ctrl+J will do something different.* In a terminal in canonical mode, they are all the same thing. There probably are some
stty
options which can change that though.hendrik
in reply to mina86 • • •mina86
in reply to hendrik • • •Yeah, my bad. I should have linked to the previous post: discuss.tchncs.de/post/3263718… (not entirely sure what’s the etiquette for linking to posts on Lemmy is).
tuna
2025-03-20 03:05:22
hendrik
in reply to mina86 • • •mina86
in reply to hendrik • • •hendrik
in reply to mina86 • • •Björn Tantau
in reply to mina86 • • •A_norny_mousse
in reply to Björn Tantau • • •👆
Let's say it together: No, it isn't
Nanook
in reply to mina86 • •they are not the same. Control D returns the carriage on old tty machines, on many modern linux platforms it is treated as CRLF, that is carriage return and a linefeed. Control-D indicates end of file or end of transmission.
perishthethought
in reply to Nanook • • •