8

I know this has been discussed on other posts but my problem does not seem to be fully resolved and I do not have permission to add a comment to those posts yet :(

listed on help.ubuntu.com > UsingTheTerminal > Save on Typing:

Tab: "It autocompletes any commands or filenames".

After following the advise from apt-get autocomplete I get results after pressing tab twice but no auto completion for commands or files. Running Xubuntu 13.04.

1
  • 2
    it completes file name only if the initials you are providing is unique , and dont have any other possible file name.
    – Sukupa91
    Nov 27, 2013 at 12:51

3 Answers 3

11

To enable smart completion

Using sudo and your favorite editor, edit your /etc/bash.bashrc file.

Uncomment the following lines, by removing the # in the beginning of the lines:

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

Now you can use tab completion to power your way through commands.

0
3

This can be frustrating, that is for sure! One quick and easy workaround would to just use bash instead of sh.

You may be defaulting to using /bin/sh as your shell instead of /bin/bash. Personally I like bash better as it has Tab-autocompletion turned on out of the box.

Check to determine your shell:

$ echo $SHELL
/bin/sh               <-- this may be your issue

Launch bash to ensure this fixes the issue:

bash

Now try the Tab-autocompletion. If it works, then change your default shell from /bin/sh to /bin/bash using the chsh (change shell) command for that user:

chsh -s /bin/bash USERNAME

Logout and log back in. Now all new shells will Tab-autocomplete.

2

it completes file name only if the initials you are providing is unique , and don’t have any other possible file name:

Suppose you have two file file1expo and file2expo in working directory-

then using gedit file<<tab>> will not work because it has two possible outcomes, where as gedit file1<<tab>> will work.

If you want to list all the files starting with initials like xaa then simply use

ls "xaa" 

it will show all the files names with starting characters xaa.

2
  • 1
    @Sushantip606 Thank you for making that clear. My bad haste - it does state this in help.ubuntu: "A very useful feature. It autocompletes any commands or filenames, (if there's only one option), or else gives you a list of options. " I Nov 27, 2013 at 13:05
  • if you want to know something else then please make another question and if answer has explained what you were expecting then just accept it as answer.
    – Sukupa91
    Nov 27, 2013 at 13:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .