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
1
apt install bash-completion
2
3
# In file /etc/profile
4
if [ -f /etc/bash_completion ]; then
5
. /etc/bash_completion
6
fi
Copied!

2. Mac (with wireguard vpn)

1
bash --version
2
GNU bash, version 5.0.7(1)-release (x86_64-apple-darwin18.5.0)
3
4
brew install bash-completion
5
brew reinstall bash-completion
6
7
# In file ~/.bash_profile
8
9
[[ ${BASH_VERSINFO[0]} -ge 4 ]] || return 0
10
if [ -f $(brew --prefix)/etc/bash_completion ]; then
11
. $(brew --prefix)/etc/bash_completion
12
fi
Copied!

Reference

Last modified 2yr ago