前言
RetHat 系列 Linux 发行版,如 Centos 7,自带历史命令补全。
如之前敲过一条命令:
1 | ps -ef | grep sshd |
下次再敲只需要按敲 ps
再按 PageUp
键即可自动补全,非常方便。
而 Debian 系列如 Ubuntu 20.04 默认没开启这项功能。
开启历史命令补全
1 | vim /etc/inputrc |
下两条设置取消注释:
1 | # alternate mappings for "page up" and "page down" to search the history |
改为:
1 | # alternate mappings for "page up" and "page down" to search the history |
然后执行 exec bash
即可。