Is there a way to set a minimum number of characters to Bash's tab completion?
My reason is that I often accidentally press the tab key on an empty command line and it takes forever to load the command list.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityIs there a way to set a minimum number of characters to Bash's tab completion?
My reason is that I often accidentally press the tab key on an empty command line and it takes forever to load the command list.
You can tell bash/completion to NOT try completion for an empty entry through the use of the 'no_empty_cmd_completion' shell option.
In your .bashrc (or alternate), enter this command:
shopt -s no_empty_cmd_completion
Exit your bash session and restart (or 'source .bashrc'), and pressing TAB at an empty prompt will just ignore you.
You can type the command at the prompt if you want to try it out beforehand.
I often accidentally press the tab key on an empty command line and it takes forever to load the command list.
complete -E
can solve above problem, but to figure out the character specific limit is difficult, since it might be inside libraries.
Since we have not specified either directory ( -d
) or file ( -f
), it will not search for neither file nor directory.