Thursday, May 9, 2024
144
rated 0 times [  144] [ 0]  / answers: 1 / hits: 259485  / 2 Years ago, sat, february 12, 2022, 6:24:51

If I start typing a command like apt-g after hitting tab, the shell completes the command to apt-get, but for the second part of the command like install, if I enter some characters like insta, hitting tab, doesn't complete it to install.



Another example: after I enter sudo hitting tab doesn't complete anything. for example: sudo apt-ge [tab] and nothing.



I installed Ubuntu using mini iso (40MB network installer), so maybe there is a config that I missed!



I've added this code to my .bashrc but still it does not works:



if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi


I have also checked the permission of .bashrc and it's -rw-r--r--.



I also source the .bashrc after changes using source .bashrc to apply the changes to the new environment but still no effects.



I use xfce4-terminal so I thought it might be the terminal and not the bash.



But editing:



~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml


And changing:



<property name="&lt;Super&gt;Tab" type="string" value="switch_window_key"/>


to:



<property name="&lt;Super&gt;Tab" type="string" value="empty"/>


Doesn't makes any difference too.


More From » command-line

 Answers
3

bash-completion is a set of bash scripts which enables customized completion for specific commands.


This is not just for files and directories, but also e.g. for the commands. So you type partial of commands and by hitting Tab we get a auto completion of commands.


Installation


Step 1: Install bash-completion


$ sudo apt-get install bash-completion

And some times it works if we re-installed it by the follwing command:


$ sudo apt-get install --reinstall bash-completion

Step 2: Enable bash-completion in your .bashrc file


Open your gedit ~/.bashrc and if these content doesn't exist there, add them at the end of it and save it.


# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi

Important: After changing the file you need to source your ~/.bashrc with source ~/.bashrc or reopen your Terminal. It should be fixed now.


[#22540] Saturday, February 12, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gigglcept

Total Points: 113
Total Questions: 105
Total Answers: 125

Location: Christmas Island
Member since Wed, Jan 13, 2021
3 Years ago
gigglcept questions
Mon, Jul 5, 21, 19:38, 3 Years ago
Thu, May 27, 21, 13:35, 3 Years ago
Tue, Feb 8, 22, 09:59, 2 Years ago
Fri, Dec 16, 22, 12:32, 1 Year ago
;