How to fix “_get_comp_words_by_ref: command not found”

The
You can download this article in PDF format to support us through the following link.

Download the guide as a PDF

turn off
The

The
The

If you continue to receive error messages “_get_comp_words_by_ref: command not found“, When you try to use the completion script to perform a bash completion operation for a custom command, it means that the bash-completion package is not installed. The tab completion function is used to automatically complete a command or suggest an option when you press Tab.

Fix _get_comp_words_by_ref: command not found

solve”_get_comp_words_by_ref: command not found“Install the bash-completion package. From one Linux distribution to another Linux distribution, the commands to be run vary, depending on the package management tool you use.

Install bash-completion on CentOS / RHEL:

sudo yum -y install bash-completion

Install bash-completion on Fedora:

sudo dnf -y install bash-completion

Install bash-completion on Ubuntu / Debian

sudo apt install bash-completion

Install bash-completion on macOS:

brew install bash-completion

After installing bash-completion on the system. Log out of the current session:

$ logout

Log in again and get your completion script.

$ source /path/to/completion/script

If the source command has been added to the ~ / .bashrc file, then just run:

$ source ~/.bashrc

Now try to use tab completion. See the example below.

$ oc  
adm              cancel-build     delete           extract          logout           plugin           replace          serviceaccounts  
annotate         cluster-info     describe         get              logs             policy           rollback         set              
api-resources    completion       diff             idle             new-app          port-forward     rollout          start-build      
api-versions     config           edit             image            new-build        process          rsh              status           
apply            convert          ex               import-image     new-project      project          rsync            tag              
attach           cp               exec             kustomize        observe          projects         run              version          
auth             create           explain          label            options          proxy            scale            wait             
autoscale        debug            expose           login            patch            registry         secrets          whoami       

I hope this guide can help you fix the “_get_comp_words_by_ref: command not found” error on Linux / macOS terminal.

How to copy and paste text content from Linux terminal

Use Cisco AnyConnect from a Linux terminal to connect to a VPN server

How to connect to a Bluetooth device from a Linux terminal

How to Google search from Linux terminal

The
You can download this article in PDF format to support us through the following link.

Download the guide as a PDF

turn off
The

The
The

Sidebar