linux创建etc,7.8. 创建 /etc/inputrc 文件

# 7.8\. 创建 /etc/inputrc 文件

`inputrc` 文件为特定的情况处理键盘映射,这个文件被 Readline 用作启动文件,Readline 是 Bash 和其它大多数 shell 使用的与输入相关的库。

大多数人并不需要自定义键盘映射,所以下面的命令将创建一个适用于所有登陆用户的全局 `/etc/inputrc` 文件。如果你需要为某个用户覆盖默认的设置,你可以在该用户的主目录中创建一个包含自定义键盘映射的 `.inputrc` 文件。

要想了解更多关于如何编辑 `inputrc` 文件的信息,运行 `info bash` 以参考 bash 的 info 页的 _Readline Init File_ 这一节,运行 `info readline` 以参考readline 自己的 info 页也不错。

下面是一个基本的全局 `inputrc` 文件,那些选项的注释也一起包括在文件里。请注意,注释不能和命令放在同一行里。

```

cat > /etc/inputrc << "EOF"

# Begin /etc/inputrc

# Modified by Chris Lynn

# 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

```

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值