Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

1 Answer 1

up vote 9 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

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.