一、Debian/Ubuntu的apt-get太常用了,不过偶尔可能也会碰到不太熟悉,想不起来的包的名称,除了去debian packages去查找,另外的方法就是给Debian/Ubuntu添加自动补齐/完成功能。方法如下:

1、安装bash-completion

    apt-get install bash-completion

2、编辑~/.bashrc 文件

添加如下内容:

if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi

3、使其生效

退出SSH,重新登录。

apt-get install build-e  然后TAB一下,自动补齐了吧。

二   那么RHEL / CentOS 怎么启用bash命令自动补齐功能呢?请看下面

1、首先需要安装bash-completion 包:

[root@server src]# yum install -y bash-completion

2、安装完成后,需要用source 命令或者是注销当前登陆用户重新登陆系统使其立即生效,如下:

[root@server src]# source /etc/bash_completion

3、此时你就可以使用bash 的自动补全了,如下:

linux 自动补全_Ubuntu

[root@server src]# yum [Tab 键]--assumeyes        --config           distro-sync        groupinfo          history            -
--cacheonly        --debuglevel       downgrade          groupinstall       info               -check              deplist            --enableplugin     grouplist          install            -check-update       --disableexcludes  --enablerepo       groupremove        --installroot      p
clean              --disableplugin    --errorlevel       help               list               -
--color            --disablerepo      --exclude          --help             makecache          -[root@server src]# yum in[Tab 键]info     install

linux 自动补全_bash_02

4、实例,加入我现在不知道apache 在centos 上面的包名,而我需要使用apache 服务,则可以这样:

[root@server src]# yum install -y htt[Tab 键]httpd-devel.i686          httpd-manual.noarch       httping.x86_64            http-parser.i686  
httpd-devel.x86_64        httpd-tools.x86_64        http-parser-devel.i686    http-parser.x86_64
httpd-itk.x86_64          httpd.x86_64              http-parser-devel.x86_64  httpry.x86_64