Zsh users at times need to use a bash completion script. This is necessitated by Developers who only write bash completion scripts for their tools. On the bright side, zsh has a bash completion script compatibility mode, you have to enable it before loading a bash completion script inside .zshrc.

Add below lines to your ~/.zshrc file before the source line.

autoload bashcompinit

You can also add the lines on top of the zshrc file to make sure no bash script is sourced prior to its loading.

These are the lines in my ~/.zshrc to enable bash completion for Cheat.

autoload bashcompinit
source /etc/profile.d/cheat.bash

I tested and confirmed to be working.

$ cheat <TAB>
zsh: do you wish to see all 1254 possibilities (1254 lines)? 

Let me know if it worked for your environment. Also check

How to configure Zsh syntax highlighting on Linux / macOS

Install Zsh on Linux and Configure

10 Best Terminal Emulators for Linux

Best Console / Terminal File Managers for Linux

Set Default Login Shell on SSSD for AD trust users using FreeIPA

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here