Bash completion on Linux/Mac

1. Debian 9

By default, debian 9 stretch does not have completion as ubuntu distro, we will need it in some specific cases and can speed up daily operation tasks

  • Autocomplete / hint when pressing tab

  • Apply for all user/profile

apt install bash-completion
# In file /etc/profile
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion

2. Mac (with wireguard vpn)

bash --version
GNU bash, version 5.0.7(1)-release (x86_64-apple-darwin18.5.0)
brew install bash-completion
brew reinstall bash-completion
# In file ~/.bash_profile
[[ ${BASH_VERSINFO[0]} -ge 4 ]] || return 0
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion