Anyone know why ctrl-m and return are the same control chars?
Asked
Active
Viewed 1,047 times
1
-
5check the ASCII tables – jsotola Aug 03 '19 at 21:25
-
Can you elaborate on what you're asking about? – slm Aug 03 '19 at 22:43
-
Highly related: Are ASCII escape sequences and control characters pairings part of a standard? (possible duplicate?) – Michael Homer Aug 03 '19 at 23:39
2 Answers
1
Carriage return or /r
has ASCII/Unicode code point 13. m
is the 13th letter of the alphabet.
Control codes go from ctrl-a (code point 1), ctrl-b (code point 2) … ctrl-z (code point 26), then Esc (code point 27), 4 more control characters, space, then the rest.

ctrl-alt-delor
- 27,993
-
"control codes" go from from
^@
(0) to^_
(0x1f), with^?
(0x7f) being an outlier. They're translated from caret notation to ascii value by xor-ing them with 0x40:#define CTRL(c) ((c) ^ 0x40)
. The space is not a control character. – Aug 04 '19 at 23:28
0
CTRL+m and CTRL+j are simply "shortcuts" or alternative keys for return

jesse_b
- 37,005
-
It's not bash's keyboard shortcuts. It's the terminal emulator's effect – 炸鱼薯条德里克 Aug 03 '19 at 21:52
-