Longer Linux commands can be tedious and inefficient So, I'll leave the procedure for setting auto-completion of commands.
Install bash-completion
> yum install -y bash-completion
Load & Confirm
> source /usr/share/bash-completion/bash_completion
#OK if there are no errors
> type _init_completion
As an example, input completion setting of yum command
> source /usr/share/bash-completion/completions/yum
#After inputting yum, if the input completion is displayed with the tab key as shown below, it is OK
> yum
check deplist groups info load-transaction reinstall search upgrade
check-update distro-sync help install makecache remove shell version
clean downgrade history list provides repolist update
/ usr / share / bash-completion / completions /
, so load them as needed.What if it's not in / usr / share / bash-completion / completions /
?
Some things are built into the command. For example, in the case of kubectl, kubectl completion bash
provides the completion function. In the case of docker-compose, install the auto-completion script according to this procedure and load it in the same way. So please find the one you want to complement and load it.
Automatic load registration
> echo 'source /usr/share/bash-completion/bash_completion' >> ~/.bashrc
> echo 'source /usr/share/bash-completion/yum' >> ~/.bashrc
Try the following two
Execute "2. Load & Confirm" above
Install bash-completion from your package manager
Execute "1. Install bash-completion" above
Recommended Posts