72

When running 'Bash on Ubuntu on Windows' it often generates the Windows notification sound while typing. Common causes are when:

  • I use auto-complete for commands (tab) and there are multiple command options,
  • or when I backspace an already empty command line.

How do I disable these sound effects?

magicandre1981
  • 97,301
  • 30
  • 179
  • 245
Silveri
  • 2,817
  • 4
  • 17
  • 21

7 Answers7

106

The answer given by Wouter works better overall once set up, but it can be slightly confusing to get working as the correct option doesn't always appear. Follow these steps:

  • Right click the volume control in the Windows taskbar
  • Open the Volume Mixer
  • Open the Bash on Windows console
  • Do something to trigger the console making the notification sound (e.g. press backspace on an empty line). If you've disabled the notification using the alternative method below, you'll have to undo it.
  • Now a Console Window Host option should have appeared in the Volume Mixer (you might have to scroll right)
  • Mute its sound setting

Volume mixer with Console Window Hos

Previous/alternative method

You can simply run the following command from within your Windows Bash shell [source]:

echo "set bell-style none" >> ~/.inputrc

or else edit .inputrc manually with a text-editor to add set bell-style none on it's own line.

You'll need to restart your currently open bash shell before it takes affect.

This will only work for your current user, and won't help if you ssh into other accounts (unless you run that command again for each account).

Silveri
  • 2,817
  • 4
  • 17
  • 21
  • 4
    What's the difference between putting `set bell-style none` in inputrc vs putting `bind "set bell-style none"` in .bashrc? Is one preferable to the other? – Jim Sep 05 '16 at 21:02
  • The latter is preferable as it's a user-configured override file and won't be subject to overwrite due to updates on the distribution version. – AvatarKava Feb 19 '17 at 07:01
  • For some reason, when I type `Python` and I'm in the Python shell, the beep still goes off. Is there any way to fix this setting for the Python interpreter as well? – Pro Q Jun 18 '18 at 18:58
  • Please note that the only way to remove the insane sound delay -- that pauses and stalls the entire shell for seconds if you have a fast keyboard repeat rate and it is processing dozens of Backspaces -- is to terminate the sound from being triggered at all. Muting your speaker will not do the job. – Jason Doucette Apr 03 '21 at 06:25
  • In mycase it is `system sounds` – Pandian Le Oct 13 '21 at 09:54
20

Add this to ~/.inputrc

set bell-style none

Additionally for vi, add this to ~/.vimrc

set visualbell
set t_vb=
Nemo
  • 921
  • 7
  • 7
  • It only work for the server were you are, if you need to connect to multiple server, you'll have to do the same on every server... – frank Nov 07 '18 at 19:23
  • @frank .inputrc and .vimrc are user specific, not specific to a host. Are you logging in as different user? – Nemo Nov 08 '18 at 15:07
13

Those using Windows Terminal, simply go to settings:

enter image description here

Select the profile you want to stop the bell on:

enter image description here

Set the bell style to none:

enter image description here

Corresponding changes in the JSON settings file:

enter image description here

Worked on Windows Terminal Preview v1.7.572.0.

MrObjectOriented
  • 303
  • 1
  • 4
  • 8
  • This doesn't work for me (Windows 11, Windows Terminal 1.14.2282.0, PowerShell 7.2.6). There is no "None" option for me; however, I have none of the other three selected (i.e. my profile defaults include `"bellStyle": "none"`). **Apparently I'm using a PowerShell module called PSReadLine and setting `Set-PSReadlineOption -BellStyle None` in my `$HOME\Documents\PowerShell\Profile.ps1` shuts it off**. – kleinfreund Sep 16 '22 at 11:13
8

Another way is to open the Volume Mixer by right clicking on the volume control in the Windows taskbar and mute the Console.

Wouter
  • 304
  • 1
  • 2
  • 6
  • Thank you! This was way more effective for me than the top answer. Even if you edit the local .inputrc, you'll still get beeps when you ssh into remote hosts (unless you put in the effort to propagate your .inputrc everywhere). – choover Aug 16 '16 at 10:36
5

If you would like to just change the sound to something less annoying instead of disabling it completely, you can go to Change system sounds from Start Menu (or under Control Panel -> Hardware and Sound -> Sound) and change the Critical Stop sound to something like "Windows Default" or "Windows Ding".

Note that this will affect any other Windows program, or Windows itself, which uses the same sound effect. I'm not able to find a good list of which actions/notifications use that sound by default.

Tobias J
  • 1,262
  • 15
  • 17
2

Tried this on Windows Terminal on PowerShell.

Go to the settings JSON file and in profiles > defaults add the line

"bellStyle": "none"

Save settings and restart the terminal.

Source: https://onelharrison.medium.com/how-to-mute-the-windows-terminal-bell-fee86af19ddb

vyb
  • 21
  • 1
  • Please note that links can break, so it is preferable if you include some content from the link. – Phoenix Sep 27 '21 at 23:25
  • 1
    Thanks for the tip, but I already included the relevant content from the link...not sure what you meant here. – vyb Sep 29 '21 at 18:40
1

I'm using Git Bash (mintty) and the above solutions didn't work for me. Of course, it refers specific to WSL (Windows Subsystem for Linux), but many of you may come over this question when using Git Bash (not sure if applies to cygwin or other bash linux emulators).

I was able to fix it by:

  • Right+click on the Git Bash title bar -> Options
  • In the left menu go to Terminal
  • In the details window, under the Bell Group Option, instead of Default Beep* -> Select no beep
  • Apply

You can test by trying to do a tab-tab for a command or anything that previously was triggering the Bell.

azbarcea
  • 121
  • 3