linux使用bash-completion补全【原创】

1、安装

yum install bash-completion-1.3-7.el6.noarch.rpm

 

2、设置

重新登录看是否生效,service + Tab看是否生效

复制代码
# service 
auditd           daytime-dgram    halt             lvm2-monitor     nginx            rpcidmapd        snmptrapd        winbind
avahi-daemon     daytime-stream   hp-asrd          mdmonitor        nmb              rpcsvcgssd       sshd             wpa_supplicant
bluetooth        discard-dgram    hp-health        messagebus       ntpd             rsync            sysstat          xinetd
cgconfig         discard-stream   hpsmhd           netbackup        ntpdate          rsyslog          tcpmux-server    zabbix_agentd
cgred            dnsmasq          httpd            netconsole       postfix          salt-minion      telnet           
chargen-dgram    ds_agent         ip6tables        netfs            rdisc            sandbox          telnet.bak       
chargen-stream   echo-dgram       iptables         network          restorecond      saslauthd        time-dgram       
chronyd          echo-stream      jexec            NetworkManager   rhnsd            single           time-stream      
crond            firstboot        killall          nfs              rpcbind          smb              udev-post        
cvs              haldaemon        lm_sensors       nfslock          rpcgssd          snmpd            vxpbx_exchanged 
复制代码

如果不生效可以使用以下方法

1)在用户家目录下

vi ~/.bashrc
. /etc/bash_completion

2)全局用户生效

echo ". /etc/bash_completion" >> /etc/profile

 

echo ". /etc/bash_completion" >> /etc/profile

3、Linux7版本

复制代码
yum install bash-completion-2.1-8.el7.noarch.rpm

vi /etc/bash_completion

if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
fi

echo ". /etc/bash_completion" >> /etc/profile
source /etc/profile
复制代码

 

4、K8S补全

yum -y install bash-completion
source /usr/share/bash-completion/bash_completion
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc

 

posted @   paul_hch  阅读(927)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
历史上的今天:
2018-09-03 linux的/etc/profile环境变量设置不生效【原创】
2018-09-03 CentOS7利用systemctl添加自定义系统服务【转】
点击右上角即可分享
微信分享提示