Linux bind命令用法详解
Linux bind命令用于显示或设置键盘按键与其相关的功能。
您可以利用bind命令了解有哪些按键组合与其功能,也可以自行指定要用哪些按键组合。
语法
bind [-dlv][-f <按键配置文件>][-m <按键配置>][-q <功能>]
参数说明:
-d 显示按键配置的内容。
-f<按键配置文件> 载入指定的按键配置文件。
-l 列出所有的功能。
-m<按键配置> 指定按键配置。
-q<功能> 显示指定功能的按键。
-v 列出目前的按键配置与其功能。
实例
显示按键组合的所有功能
# bind -l //显示按键组合的内容abort accept-linealias-expand-line arrow-key-prefix backward-bytebackward-charbackward-delete-charbackward-kill-line backward-kill-word backward-word beginning-of-history beginning-of-line……省略部分内容vi-goto-mark vi-insert-beg vi-insertion-mode vi-match vi-movement-mode vi-next-word vi-overstrike vi-overstrike-deletevi-prev-word vi-put vi-redovi-replace vi-rubout vi-search vi-search-again vi-set-mark vi-subst vi-tilde-expand vi-yank-arg vi-yank-to yank yank-last-arg yank-nth-arg yank-pop
显示当前按键组合的设置
# bind -labort accept-linealias-expand-line arrow-key-prefix backward-bytebackward-charbackward-delete-charbackward-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 complete-command complete-filename complete-hostname complete-into-braces complete-username complete-variable copy-backward-word copy-forward-word copy-region-as-kill dabbrev-expanddelete-chardelete-char-or-listdelete-horizontal-space digit-argument display-shell-versiondo-lowercase-version downcase-worddump-functionsdump-macrosdump-variablesdynamic-complete-history edit-and-execute-command emacs-editing-modeend-kbd-macroend-of-historyend-of-line exchange-point-and-mark forward-backward-delete-charforward-byteforward-charforward-search-history forward-word glob-complete-word glob-expand-word glob-list-expansions history-and-alias-expand-line history-expand-line history-search-backward history-search-forward insert-comment insert-completions insert-last-argument kill-line kill-region kill-whole-line kill-word magic-space menu-complete menu-complete-backwardnext-history non-incremental-forward-search-history non-incremental-forward-search-history-again non-incremental-reverse-search-history non-incremental-reverse-search-history-again old-menu-complete operate-and-get-nextoverwrite-mode possible-command-completions possible-completions possible-filename-completions possible-hostname-completions possible-username-completions possible-variable-completions previous-history quoted-insert redraw-current-line re-read-init-file reverse-search-history revert-lineself-insertset-mark shell-backward-kill-word shell-backward-word shell-expand-line shell-forward-word shell-kill-word skip-csi-sequence start-kbd-macro tab-insert tilde-expand transpose-chars transpose-words tty-status undo universal-argument unix-filename-rubout unix-line-discard unix-word-rubout upcase-word vi-append-eol vi-append-mode vi-arg-digit vi-back-to-indent vi-bword vi-bWord vi-change-casevi-change-charvi-change-to vi-char-search vi-column vi-complete vi-deletevi-delete-to vi-editing-mode vi-end-word vi-eof-maybe vi-eword vi-eWord vi-fetch-history vi-first-printvi-fword vi-fWord vi-goto-mark vi-insert-beg vi-insertion-mode vi-match vi-movement-mode vi-next-word vi-overstrike vi-overstrike-deletevi-prev-word vi-put vi-redovi-replace vi-rubout vi-search vi-search-again vi-set-mark vi-subst vi-tilde-expand vi-yank-arg vi-yank-to yank yank-last-arg yank-nth-arg yank-pop root@snail-hnlinux:~# root@snail-hnlinux:~# root@snail-hnlinux:~# root@snail-hnlinux:~# root@snail-hnlinux:~# bind -vset bind-tty-special-chars onset blink-matching-paren onset byte-oriented offset completion-ignore-case offset convert-meta offset disable-completion offset echo-control-characters onset enable-keypad offset enable-meta-key onset expand-tilde offset history-preserve-point offset horizontal-scroll-mode offset input-meta onset mark-directories onset mark-modified-lines offset mark-symlinked-directories offset match-hidden-files onset meta-flag onset output-meta onset page-completions onset prefer-visible-bell onset print-completions-horizontally offset revert-all-at-newline offset show-all-if-ambiguous offset show-all-if-unmodified offset skip-completed-text offset visible-stats offset bell-style audibleset comment-begin #set completion-prefix-display-length 0set completion-query-items 100set editing-mode emacsset history-size 1000set keymap emacs
列出指定功能的按键和按键组合
# bind -q abort//请用 调用abort “C-g”, “C-xC-g”, “eC-g”.# bind -q accept-line //列出功能“accept-line”按键以及组合按键//请用 调用accept-line “C-j”, “C-m”.