Tips on Bash Completion

Posted on May 06, 2025 in Computer Science

Things under legendu.net/outdated are outdated technologies that the author does not plan to update any more. Please look for better alternatives.

It is suggested that you use the fish shell instead of the bash shell (for iteractive use cases) .

Installation

Ubuntu / Debian

wajig install bash-completion

macOS

brew install bash-completion

If you don't like or cannot install bash-completion, bash-it provies completion scripts for many popular tools.

Develop Bash Completion

Auto Generate Bash Completion Scripts

  1. The cobra library in GoLang supports auto genrating shell (bash, fish, zsh and PowerShell) completion scripts.

  2. The Python library argcomplete provides easy, extensible command line tab completion of arguments for your Python application. It makes two assumptions:

    • You're using bash or zsh as your shell.
    • You're using argparse to manage your command line arguments/options.
  3. The Ruby library (and also command-line tool) completely lets you generate bash completion scripts from simple YAML configuration.