Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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 Jan 21 '12 at 14:39
up vote 8 down vote accepted


 set disable-completion on

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

share|improve this answer
not only in bash though... – yarek Jan 19 '12 at 20:07
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' – Dennis Williamson Jan 19 '12 at 20:13
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 Jan 20 '12 at 22:51

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

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

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.

share|improve this answer

Your Answer


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.