Results 1 to 9 of 9

Thread: Bash tab-auto complete not working 100%

  1. #1
    Join Date
    Dec 2010
    Beans
    Hidden!

    Lightbulb Bash tab-auto complete not working 100%

    Recently installed 11.10 and it is working very well.

    One issue I have run across is that in Terminal only the first command will tab-auto complete...

    Example:

    I want to use "sudo apt-get update".
    Only sudo will tab-auto complete, the rest I must type out.

    Normally I could hit tab for all three words.

    Any thoughts and suggestions are welcomed



    Cheers
    404
    404

    Come shoot the breeze with us on the Ubuntu Forums IRC channel - #ubuntuforums

  2. #2
    Join Date
    May 2008
    Beans
    1,438
    Distro
    Ubuntu Development Release

    Re: Bash tab-auto complete not working 100%

    Had a similar issue on Fedora a while back. This did it for me.

    Just a shot in the dark

  3. #3
    Join Date
    Dec 2010
    Beans
    Hidden!

    Re: Bash tab-auto complete not working 100%

    Quote Originally Posted by kaldor View Post
    Had a similar issue on Fedora a while back. This did it for me.

    Just a shot in the dark
    That didn't help 100%.

    It did auto-complete more than normal... but when I hit the tab auto-complete after "sudo apt-get" and wanted to have "install" it gave me a list of applications that started with "ins" and not the variables for apt-get as I am used to with previous releases

    I have removed the two lines in the link you have given me for now...


    Cheers
    404
    404

    Come shoot the breeze with us on the Ubuntu Forums IRC channel - #ubuntuforums

  4. #4
    Join Date
    Dec 2010
    Beans
    Hidden!

    Re: Bash tab-auto complete not working 100%

    Thanks to inetpro over at #ubuntu-za on Freenode I was able to get it working.

    The link he supplied me was http://embraceubuntu.com/2006/01/28/...rt-completion/ ...

    I edited my etc/bash.bashrc file and uncommented the following bit:
    Code:
    # enable bash completion in interactive shells
    if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
        . /etc/bash_completion
    fi
    Worked like a charm...


    404
    404

    Come shoot the breeze with us on the Ubuntu Forums IRC channel - #ubuntuforums

  5. #5
    Join Date
    Jan 2007
    Beans
    84

    Re: Bash tab-auto complete not working 100%

    Thanks for the fix! Any idea why such an obviously useful feature is disabled by default?

  6. #6
    Join Date
    Apr 2007
    Beans
    4

    Re: Bash tab-auto complete not working 100%

    Quote Originally Posted by not found View Post
    Thanks to inetpro over at #ubuntu-za on Freenode I was able to get it working.

    The link he supplied me was http://embraceubuntu.com/2006/01/28/...rt-completion/ ...

    I edited my etc/bash.bashrc file and uncommented the following bit:
    Code:
    # enable bash completion in interactive shells
    if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
        . /etc/bash_completion
    fi
    Worked like a charm...
    Had the completion lines on as shown above, but sudo would not complete anymore on Quantal as well as wanting a way to quickly complete known computers I connect to. I added the following to my ~/.bashrc after doing the above, but I only added what is below in my home directory's bashrc file (~/.bashrc) . . .

    Code:
    if [ "$TERM" != "dumb" ]; then
         complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ssh
         complete -W "$PATH" sudo
         complete -cf sudo
    fi

  7. #7
    Join Date
    Apr 2012
    Beans
    67

    Re: Bash tab-auto complete not working 100%

    On my VPS:
    Code:
    sudo apt-get install bash-completion
    sudo apt-get update
    - uncomment completion stuff from /etc/bash.bashrc
    - comment out completion stuff from ~/.bashrc

    Now it works like it should, I think. All steps might not be needed, but it works like that for me.

  8. #8
    Join Date
    Mar 2009
    Location
    Singapore
    Beans
    88
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Bash tab-auto complete not working 100%

    Another thing I found which sorted my problems was the last few lines of ~/.bashrc:
    # Enable auto-complete function fully
    complete -cf sudo
    complete -cf man
    Make sure these two lines are commented out, otherwise it will list every single possible option for autocomplete.

  9. #9
    Join Date
    Aug 2007
    Beans
    204
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Bash tab-auto complete not working 100%

    I followed #4 on Ubuntu Server 12.04 and it still refuses to work for files within a given directory.

    Any suggestions which of the various remedies talked about on this thread gets tab auto complete working again for files?
    Michael Lueck

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •