I'm using Ubuntu 14.04 (updated), in terminal, auto complete works well but when I'm using adb command in terminal, auto complete does not work anymore..

share|improve this question
up vote 8 down vote accepted

Just perform the following simple steps:

  1. Copy and paste the adb bash completion from here on github by mbrubeck and save in a file named adb.txt or the name you prefer.
  2. Store the file somewhere safe. Anywhere you want in your $PATH. I choose /bin but the standard file location is /usr/local/bin.
  3. Use your favorite editor of choice (which should be vim IMHO) to edit your ~/.bashrc file.
  4. Add the following lines (substitute your own path to the adb bash completion file) to the end of your ~/.bashrc file (not edit the .bashrc in sudo mode):

    if [ -e /bin/adb.txt ] ; then
      source /bin/adb.txt
    fi
    
  5. Save and quit. To reload your bash type:

    source ~/.bashrc
    
  6. Check if it works. Type adb d and press Tab to see if it autocompletes to adb devices.

Here you can find the full manual to AutoComplete ADB.

share|improve this answer
    
Although your answer is 100% correct, it might also become 100% useless if that link is moved, changed, merged into another one or the main site just disappears... :-( Therefore, please edit your answer, and copy the relevant steps from the link into your answer, thereby guaranteeing your answer for 100% of the lifetime of this site! ;-) You can always leave the link in at the bottom of your answer as a source for your material... – Fabby May 2 '15 at 15:04
    
@Fabby Answer got expanded. – Byte Commander May 2 '15 at 17:29
    
Good one now! Upvoted! :-) Tip: use 8 spaces instead of 4 when using numbered lists. Please review my edits for further tips&tricks... ;-) @ByteCommander: thanks for the heads-up! – Fabby May 2 '15 at 18:02
1  
@Fabby thanks for the correction, next time I'll follow the tips – ad3luc May 2 '15 at 19:06
    
Thanks for reply..I tried this but still not working...:( – Deniz May 5 '15 at 9:12
  1. Download this script.

  2. Install bash-completion if you haven't already by running:

    sudo apt-get install bash-completion

  3. Copy the downloaded file from step 1 into the /etc/bash_completion.d folder

  4. Restart your shell.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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