5

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.

  • 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 '13 at 12:51
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.

  • 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 – user1575949 Nov 27 '13 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 '13 at 13:11
6

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.

1

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"

Change Default Shell to bash using the chsh (change shell) command for that user.

chsh -s /bin/bash USERNAME

Logout. Log back in. Now all new shell's will tab autocomplete. :)

Shane

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.