Results 1 to 4 of 4

Thread: Bash tab completion stops working with some commands

  1. #1
    Join Date
    Apr 2020
    Location
    where the work takes me
    Beans
    199
    Distro
    Ubuntu 20.04 Focal Fossa

    Bash tab completion stops working with some commands

    Hello all,

    Occasionally tab completion will (seemingly) randomly stop working with certain commands, it will continue to function with others though.

    The latest command to stop working was openvpn, I can press tab to complete the actual command but it wont work with any long options or arguments, other commands are working fine with tab completion, and it just stopped working suddenly as I was using it.

    I've re-installed openvpn and bash completion, restarted the computer and sourced ~/.bashrc but still it doesn't work. I've had the same problem with other commands in the past which I think probably eventually fixed themselves, but it's rather annoying when it happens, especially for commands which take long, esoteric file paths as arguments.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,702
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Bash tab completion stops working with some commands

    If you are going to use a command more than once, put it into a script and store it in your ~/bin/ directory. Be certain to put enough commenting in each file so you can 'grep' it later when you need a similar solution.

    Sorry, I've not experienced what you have. Could an alias be getting in the way of the completion? Have to watch out when using aliases or bash functions.

  3. #3
    Join Date
    Dec 2014
    Beans
    1,625

    Re: Bash tab completion stops working with some commands

    The command line completion is programmable. There are several hundreds of scripts involved if you're counting the specialized scripts in /etc/bash_completion.d/ and /usr/share/bash-completion/completions/ which each encode the syntax and options for a single command. Those scripts are mostly installed by the package bash-completion, but a program can bring along it's own completion script and of course a user could write his own completion-script (although those should go into ~/.local/etc/bash_completion.d/).

    If something breaks there are a few tricks for working around the breakage. Meta-! completes a command, Meta-/ completes a path and file name, Meta-@ completes a hostname, Meta-~ completes a username and Meta-$ completes a variable. On most keyboard layouts Meta is bound to the Alt-key.

    Holger

  4. #4
    Join Date
    Apr 2020
    Location
    where the work takes me
    Beans
    199
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Bash tab completion stops working with some commands

    Quote Originally Posted by Holger_Gehrke View Post
    If something breaks there are a few tricks for working around the breakage. Meta-! completes a command, Meta-/ completes a path and file name, Meta-@ completes a hostname, Meta-~ completes a username and Meta-$ completes a variable. On most keyboard layouts Meta is bound to the Alt-key.
    Thanks, this was really helpful.

    Just now worked out that the actual tab completion only works when I sudo the command, that's why it 'broke', as I was trying to run it without. I wonder why this could be?

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
  •