Is it possible to disable bash's autocomplete on pressing tab?

The reason I want to do this is that I often paste code from an editor where I use the tab character instead of a number of spaces for indention, into my terminal.

And no, you can't convince me to use spaces instead of tabs.

  • In zsh, the Tab key inserts a tab if you press it at the beginning of a line (before any non-whitespace character). I don't think bash can be programmed for that (you can bind a key to a bash function, but AFAIK you can't trigger a completion from that bash function). – Gilles 'SO- stop being evil' Jan 21 '12 at 14:39


 set disable-completion on

string in ~/.inputrc and restart your shell. it will disable completion at all.

| improve this answer | |
  • not only in bash though... – yrk Jan 19 '12 at 20:07
  • 8
    To have it only affect Bash, instead of including that line in your ~/.inputrc file, add this to the appropriate shell startup file: bind 'set disable-completion on' – Paused until further notice. Jan 19 '12 at 20:13
  • 1
    What Dennis said, and the appropriate startup file is ~/.bashrc (if it doesn't take in login shells, add source ~/.bashrc to ~/.bash_profile). – Gilles 'SO- stop being evil' Jan 20 '12 at 22:51

Dennis' solution

bind 'set disable-completion on'

can be done on the fly in Bash as well. You do not need to put it in .bashrc.

Musta's solution (bash --noediting) works but also disables command line editing.

Another way is

bind -u complete

(unset key binding associated with 'complete')

http://www.gnu.org/software/bash/manual/bashref.html, 4.2 Bash Builtin Commands.

| improve this answer | |
  • The correct answer for the question "how do I temporarily disable Bash completion?" This helps a lot when you're navigating through a directory with 81,000+ files and you can't even Ctrl+C without waiting two minutes for Bash to come back with a prompt. – TheDudeAbides Nov 21 '18 at 23:07

To disable Bash tab completion only temporarily you can start a Bash with the --noediting option:

alias noed='bash --noediting'
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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