Reputation: 2083
Not sure how to query for what I am looking for in a search engine:
I want to determine the names of Linux shell commands that are mapped to default keyboard shortcuts (return, backspace, ctrl+c, etc.).
For instance, I want to know the explicit name of the command that is executed when I press "return". I don't just want a link to "basic shell commands", I want to know the mappings in the command-line instance I am currently on.
Upvotes: 0
Views: 245
Reputation: 58768
To pretty-print all active readline
key bindings:
bind -P | grep --fixed-strings ' can be found on ' | perl -pe 's/((?<!\\)(?:\\\\)*)\\C/\1Ctrl/g;s/((?<!\\)(?:\\\\)*)\\e/\1Esc,/g'
That said, some bindings like Ctrl-c, Enter are not mapped to "shell commands" but rather to internal functions of the current shell. To figure out what a shell does when you press Ctrl-c you'd have to refer to the actual source code of the program which captures the shortcut, which could include anything from the shell to any other program in the foreground of the stack running in the shell.
Upvotes: 1