bind

Display or set keyboard keys and their associated functions

Supplementary instructions

bind command is used to display and set the keyboard sequence binding function of the command line. This command can improve the efficiency of command line operations. You can use the bind command to learn which key combinations and their functions are available, or you can specify which key combinations to use.

grammar

bind(option)

Options

-d: Display the content of key configuration;
-f<key configuration file>: load the specified key configuration file;
-l: List all functions;
-m<key configuration>: Specify key configuration;
-q<function>: displays the keys for the specified function;
-v: List the current key configuration and its functions.

Example

bind -x '"\C-l":ls -l' #Press CTRL+L directly to list the directory

The keyseq can be obtained using the showkey -a command:

showkey -a

Press any keys - Ctrl-D will terminate this program

^[[A 27 0033 0x1b on
          91 0133 0x5b
          65 0101 0x41
^[[B 27 0033 0x1b next
          91 0133 0x5b
          66 0102 0x42
^[[D 27 0033 0x1b left
          91 0133 0x5b
          68 0104 0x44
^[[C 27 0033 0x1b right
          91 0133 0x5b
          67 0103 0x43
          32 0040 0x20
^M 13 0015 0x0d letter M
^C 3 0003 0x03 Ctrl-C
^D 4 0004 0x04 Ctrl-D Exit