[Linux] step by step learning Linux - bind command

  1. Directory
    article directories
  2. table of Contents
  3. Command Overview
  4. Command Format
  5. Common options
  6. Reference Example
  7. appendix
  8. Command Overview
    bind command sequence for binding function keyboard and display settings of the command line. With this command, you can improve the operating efficiency of the command line. You can use the bind command to know what its function key combination, you can also specify which key combination to use on their own.

  9. Syntax
    Usage: bind [options] [parameters]
    1
  10. Common options
    -m key mappings using the specified key mapping during the execution of this command.
    It may be acceptable to key mapping name has emacs,
    emacs-Standard, emacs-Meta, CTLx-emacs, vi,
    vi-the Move, the Command-vi, and vi-insert.
    -l lists the function name.
    -P lists the function names and bindings.
    -p lists the function name and the format can be re-used as input
    binding.
    -S lists can start the macro key sequence and their values
    -s listed in format can be re-used as an input may start the macro
    keys and their values.
    -V List variable names and their values into the
    -v lists in a format that can be re-used as an input variable name
    and their values
    -q function name specified in the query function which can be activated by the key.
    -u function name unbind all bindings to the specified function key.
    -r key sequence to cancel the specified binding key sequences.
    -f filename Read key bindings from specified file.
    -x key sequence: The shell command when a specified key sequence is input, performs
    the specified command shell

  11. Reference Example
    4.1 lists function names

[deng@localhost ~]$ bind -l
abort
accept-line
alias-expand-line
arrow-key-prefix
backward-byte
backward-char
backward-delete-char
backward-kill-line
backward-kill-word
backward-word
beginning-of-history
beginning-of-line
call-last-kbd-macro
capitalize-word
character-search
character-search-backward
clear-screen
complete
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
4.2 显示按键组合的设置

[deng@localhost ~]$ bind -v
set bind-tty-special-chars on
set blink-matching-paren on
set byte-oriented off
set completion-ignore-case off
set completion-map-case off
set convert-meta off
set disable-completion off
set echo-control-characters on
set enable-keypad off
set enable-meta-key on
set expand-tilde off
set history-preserve-point off
set horizontal-scroll-mode off
set input-meta on
set mark-directories on
set mark-modified-lines off
set mark-symlinked-directories on
set match-hidden-files on
set menu-complete-display-prefix off
set meta-flag on
set output-meta on
set page-completions on
set prefer-visible-bell on
set print-completions-horizontally off
set revert-all-at-newline off
set show-all-if-ambiguous off
set show-all-if-unmodified off
set skip-completed-text off
set visible-stats off
set bell-style audible
set comment-begin #
set completion-display-width -1
set completion-prefix-display-length 0
set completion-query-items 100
set editing-mode emacs
set history-size 1000
set keymap emacs
[deng@localhost ~]$

4.3 Setting key combination, Ctrl + l, 111 may be displayed

[deng@localhost ~]$ bind -x '"\C-l":echo 111'

[deng@localhost ~]$

4.4 lists the keys and key combinations of the specified functions

[Deng @ localhost ~] $ -q the bind ABORT
ABORT may be invoked by "\ Cg", "\ Cx \ Cg", "\ E \ Cg."
[Deng @ localhost ~] $
. 1
2
. 3
4.5 of 5 may be used keyseq showkey -a command to get

[root@localhost ~]# showkey -a

Press any keys - Ctrl-D will terminate this program

^ [[A 27 0033 on 0x1b
91 is 0133 0x5b
65 0101 0x41
^ [[B 27 0033 0x1b at
91 is 0133 0x5b
66 0102 0x42
^ [[D 27 0033 0x1b left
91 is 0133 0x5b
68 0104 0x44
^ [[C 27 0033 0x1b Right
0133 0x5b 91 is
67 0103 0x43
32 0x20 0040
^ 0015 M 13 is 0x0D letter M
^ C. 3 the Ctrl-C 0003 0x03
^. 4 D D-0004 to exit the Ctrl 0x04

Guess you like

Origin blog.51cto.com/14537151/2438913