• bobo@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    2 hours ago

    Bash will also do autocomplete for cli programs that have autocomplete functionality. Try typing:

    git r<tab><tab>

    you’ll see options for all the git commands that start with r. Often cli commands will have autocompletion for long (double dash) options.

    If you want to see all the commands that have auto complete available, look in:

    /usr/share/bash-completion/completions/

    There’s a few other locations they can live, notably:

    /etc/bash_completion.d/ ~/.bash_completion ~/.local/share/bash-completion/completions/

    I don’t know if there are more or if there is any variation per distro.

    You can also write your own bash completions. They can get pretty smart and context sensitive.

    Pretty good beginning tutorial:

    https://iridakos.com/programming/2018/03/01/bash-programmable-completion-tutorial

    edit - I should’ve mentioned that this isn’t native to bash, it requires installation of bash-completion. But bash-completion is installed by default in many distros.