解决 ubuntu apt-get TAB 键不能自动补全

Add Bash Completion In Debian

ash completion is a useful tool for completion of file paths, commands etc. By default it is enabled on Ubuntu but not on Debian. With two simple steps it can also be enabled on Debian.

1. Install bash-completion

First of all we need the install the according package:

apt-get install bash-completion

2. Add it to the bash profile

Either edit the ~/.bash_profile file to enable it only for a given user or edit /etc/profile to add it system-wide. Add the following code:
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
3. Try it

In order for it to work you have to log out and relogin and then you can make use of bash completion the usual way. E.g. issue:
apt-g

and then press the TAB key once and the command will be completed to apt-get. Or issue this:
apt

and then press TAB key twice. You can also try with
apt-get install apa

and then press TAB key once to complete as far as possible and a second time to list all options.

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
apt-get ins是一个错误的命令,正确的命令是apt-get install。在你的描述中,你提到在命令行输入sudo apt-get ins然后按tab时无法自动。这可能是因为你的bash shell的自动功能没有启用。你可以检查你的.bashrc文件,确保以下配置被启用: # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). 如果这个配置没有被启用,你可以取消注释这行配置,然后重新启动你的终端。这样,当你输入sudo apt-get ins并按tab时,应该可以自动为sudo apt-get install。 #### 引用[.reference_title] - *1* [apt-get](https://blog.csdn.net/gtestcandle/article/details/126853328)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [apt-get install](https://blog.csdn.net/qq_35608277/article/details/84997363)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [ubuntu 14.04 apt-get install 不能自动解决办法](https://blog.csdn.net/huangyuan_xuan/article/details/48915299)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值