Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers 2

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.

share|improve this answer
add comment

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.

share|improve this answer
    
Oh thanks slihck :-) –  Peeyush Sep 5 '11 at 10:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.