inputrc文件文件处理特定情况下的键盘映射。此文件是 Readline(由 Bash 和大多数其他 Shell 使用的输入相关库)使用的启动文件。
大多数人不需要特定于用户的键盘映射,因此下面的命令创建一个全局/etc/inputrc供每个登录的人使用。如果您以后决定需要覆盖每个用户的默认值,则可以在用户的 home 目录中创建一个.inputrc文件,其中包含修改后的映射。
有关如何编辑文件文件的更多信息,请参阅 info bash 中的 Readline Init File 部分。 info readline 也是一个很好的信息来源。
下面是一个通用的全局文件以及解释各种选项作用的注释。请注意,注释不能与命令位于同一行。使用以下命令创建文件
cat > /etc/inputrc << "EOF" # Begin /etc/inputrc # Modified by Chris Lynn <roryo@roryo.dynup.net> # Allow the command prompt to wrap to the next line set horizontal-scroll-mode Off # Enable 8bit input set meta-flag On set input-meta On # Turns off 8th bit stripping set convert-meta Off # Keep the 8th bit for display set output-meta On # none, visible or audible set bell-style none # All of the following map the escape sequence of the # value contained inside the 1st argument to the # readline specific functions "\eOd": backward-word "\eOc": forward-word # for linux console "\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 # for xterm "\eOH": beginning-of-line "\eOF": end-of-line # for Konsole "\e[H": beginning-of-line "\e[F": end-of-line # End /etc/inputrc EOF