86

I find the beep useful for some things, so I only want to turn it off for tab completion (I'm not asking how to completely turn it off, that has already been answered in a different question on Serverfault). I also don't have root access, working on RHEL5.

0

4 Answers 4

105

Readline library has bell-style variable:

Controls what happens when Readline wants to ring the terminal bell. If set to ‘none’, Readline never rings the bell. If set to ‘visible’, Readline uses a visible bell if one is available. If set to ‘audible’ (the default), Readline attempts to ring the terminal’s bell.

So you can put into your ~/.inputrc file following line:

 set bell-style none

Next, run bind -f ~/.inputrc once to load it.

3
  • 7
    If you want this setup to be default for all users of the system, you can edit /etc/inputrc config file with root user. Aug 12, 2015 at 8:28
  • 2
    then run bind -f ~/.inputrc to reload it.
    – wisbucky
    Jun 17, 2020 at 17:14
  • Thank you, SO much!! I was nearing the point of projectile reconfiguration of my system (throwing my laptop across the room).
    – cycollins
    Nov 16, 2023 at 6:50
30

If you don't want to create and maintain a separate ~/.inputrc file, you can also just add this line to ~/.bashrc:

bind 'set bell-style none'

Then source ~/.bashrc to reload it.

1
  • 2
    This is the ONLY solution that worked for me (although "visible" option doesn't work). Even disabling Critical Stop and Default Beep Windows sounds didn't work (using WSL in ConEmu).
    – Moos
    Jan 10, 2021 at 19:50
17

I'm not aware of any way to disable the tab completion bell in bash (aside from disabling the bell entirely or changing it to the subjectively-more-annoying visual bell).

You could try set show-all-if-ambiguous on in your ~/.inputrc - this makes the shell show the list of matching commands/items immediately when you hit tab instead of waiting for you to hit tab twice.
A side effect is that there is no bell before the candidate matches are shown.

8

In ~/.inputrc, there exists the following possibility, but it didn't do anything for me. It just rings the bell. This may be a bug in the Cygwin bash.

set bell-style visible

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .