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.
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.
Isn’t ctrl-m the “enter” equivalent?
Yes. So is Ctrl+J actually. Ctrl+J corresponds to line feed (LF) and Ctrl+M corresponds to carriage return (CR) ASCII characters. They are typically treated the same way.
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?
Yeah, it’s a bit philosophical.
bind -x '"\C-j":"echo a"'
in bash and Ctrl+J will do something different.stty
options which can change that though.