Previous Page | Next Page

  1. Introduction
  2. Abbreviated Boot
  3. The Boot Process
  4. Startup and Run Levels
  5. Initialization Scripts
  6. Runlevel Scripts
  7. Login Process
  8. Bash Shell
  9. Filesystems
  10. LILO, Kernel and Root Filesystem
  11. The Kernel
  12. Passwords, Users, Groups, and Quotas
  13. The Environment
  14. The /etc/sysconfig directory
  15. The /proc filesystem
  16. Process Control
  17. Devices
  18. Daemons Services
  19. Inetd and Network Services
  20. Programs and Libraries
  21. Security and PAM
  22. The printer services
  23. Mouse support with gpm
  24. Mail
  25. News
  26. UUCP
  27. LDAP
  28. NFS and RPC
  29. Samba, NetBIOS, WINS, nmbd
  30. Identd (auth)
  31. Telnet and FTP
  32. Apache web server
  33. DNS and named
  34. How X Works
  35. X Scripts
  36. Support for Text
  37. Keymapping for Programs
  38. Keycode Table
  39. Example Keymap File
  40. Terminfo Commands
  41. VT100 ESC sequences
  42. Kernel Revisited
  43. Configuration Files
  44. Credits

Linux Keymapping for Programs

Applications and keycodes

bash

Bash can be controlled with the inputrc file which is used to set up key control with the bash shell. The "/etc/inputrc" or the ".inputrc" file in the users home directory will set up key codes for bash. My /etc/inputrc file:

set meta-flag on
set input-meta on
set convert-meta off
set output-meta on
"\e0d": backward-word
"\e0c": forward-word
"\e[h": beginning-of-line
"\e[f": end-of-line
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert

This file allows the following flags to be set on or off:

  • bell-style - Possible values are audible (the default), visible, or none. This controls what happens when the Readline function wants to ring the bell.
  • comment-begin - The default is #. This defines the string that will be inserted at the start of the line when the insert-comment command if received.
  • completion-ignore-case
  • completion-query-items
  • convert-meta - If on (the default), characters are converted to the ASC seven bit character set.
  • disable-completion
  • editing mode - May be set to emacs or vi
  • enable-keyboard
  • expand-tilde
  • horizontal-scroll-mode
  • input-meta - If set to on, eight bit input is enabled. If off (the default) it only passes seven bits of any character.
  • isearch-terminators
  • keymap
  • mark-directories
  • mark-modified-lines
  • output-meta
  • print-completions-horizontally
  • show-all-if-ambiguous
  • visible-stats

The following sequences are used to help define keys:

  • \C- = Control
  • \M- = Meta
  • \e = escape character
  • \\ = backslach

The below commands can be put in "/etc/inputrc" or "$HOME/.inputrc".
The commands:

set editing-mode emacs
"\e[3~":delete-char

will set the default keybindings to those used by the emacs editor, and bash will recognize the delete key.

The commands:

"\e[1~": beginning-of-line
"\e[3~": delete-char
"\e[4~": end-of-line

will map the <Home>, <Delete>, and <End> keys respectively to the corresponding functions. You can tell which characters are mapped by examining the keycode table.

You may need the following line if your BackSpace key sends the ASCII delete character:

DEL: backward-delete-char

For complete information, read the "Bash Reference Manual" by Chet Ramey, and Brian Fox.