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 autocompletion for a specific command only?

Use case: For obvious reasons, I would like to disable autocompletion for the rm command when I'm root. It would also be a terrible pain if I disabled autocompletion altogether, so I'd like to remove it for rm only.

Can this be done at all, preferably without hacking /etc/bash_completion and friends?

share|improve this question
up vote 11 down vote accepted

You can do this easily by setting rm's completion to an empty wordlist.

complete -W "" rm

Set it in /root/.bashrc if you only want it to apply to root.

share|improve this answer
Works just as advertised. Thank you very much! – Joseph R. Oct 17 '13 at 21:54
complete -C : rm and complete rm work too:) – Evgeny Vereshchagin Jun 28 '15 at 15:06

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.