I am confused about how Ctrl-key
combinations work in terminal. In bash man page, there are various combinations such as:
C-e
- go to end of the lineC-f
- go one character forward
etc.
But then there are some undocumented shortcuts such as:
C-j
(ORC-m
) for return key.C-h
for backspaceC-i
for tab etc.
Are these shortcuts just forgotten to be documented? Or, because
C-j
isLF
C-m
isCR
C-i
isTab
in ASCII, is this somehow a "default" behavior? In other words, is the behavior for C-j
, C-m
and C-i
not implemented by bash but by something else?
Another question is, when I press C-v
and left arrow key, ^[[D
appears on screen. I.e, ESC-[-d
. But when I press ESC-[-d
, the cursor does not move left. What is the reason for this?
EDIT:
Initially, I have thought that when I press C-j
, the keyboard directly sends 00001010
to kernel. But then I decided that this is not the case, because using programs such as xev
or evtest
, I have observed that key presses to Control
and j
appear as different events. So when I press C-j
, the keyboard does not send 00001010
, but probably multiple bytes. Then where the conversion of these multiple bytes to 00001010
is done?