[bash] Disable beep of Linux Bash on Windows 10

Having a Linux Bash on Windows 10 is pretty cool, but as far as I've got to struggle with the not-so-good terminal provided from Microsoft I'm gonna get stuck with Ubuntu for everything.
Anyway, is there a way to turn off that beep whenever you do something on the Bash?
Since it is not possible to comment out bell-style audible because is not there, nor is it possible to launch sc config beep start= disabled

This question is related to bash windows-10 windows-subsystem-for-linux

The answer is


right click on sound icon (bottom right) >>> open volume mixer >>> mute console window host


@Andrea Tulimiero 's answer works for local, but when you ssh to a remote server, the beep turns on again. My suggestion is to disable from the Windows 10 taskbar. There is volume mixer in the right bottom corner, which works for me.


Find the location of the .bash_profile file and enter the following into the file:

setterm -blength 0

Which will set the amount of time the beep happens to 0 and thus no beep.


You need add following lines to bash and vim config,

1) Turn off bell for bash

vi ~/.inputrc
set bell-style none

2) Turn off bell for vi

vi ~/.vimrc
set visualbell
set t_vb=

Setting the visual bell turns off the audio bell and clearing the visual bell length deactivates flashing.


its not specific to bash windows 10. but if you want remove the bell terminal for zsh, just use the right option in zshrc. (for vim, answer already posted)

unsetopt beep

http://zsh.sourceforge.net/Doc/Release/Options.html

i have find this option quickly, but would find it even faster if its was on this post ^^

hf


In addition to what jgr208 said, you may have a ~/.profile file already and ~/.bash_profile may not be present, as was the case with me.

In this case, add setterm -blength 0 to the .profile.

If you create a .bash_profile, your .profile will be ignored and anything Windows wrote there will not work.


Uncommenting set bell-style none in /etc/inputrc and creating a .bash_profile with setterm -blength 0 didn't stop vim from beeping.

What worked for me was creating a .vimrc file in my home directory with set visualbell.

Source: https://linuxconfig.org/turn-off-beep-bell-on-linux-terminal


Replace in System Sounds the "Critical Stop" to a wav-file which is silent 1.

Just removing the sound completely did not work for me. Apparently some default sound was used in this case.

System sounds configuration

(Credits for this.lau_ on SuperUser for discovering this).


Since the only noise terminals tend to make is the bell and if you want it off everywhere, the very simplest way to do it for bash on Windows:

  1. Mash backspace a bunch at the prompt
  2. Right click sound icon and choose Open Volume Mixer
  3. Lower volume on Console Window Host to zero

I found that TedMilker's solution worked, but I would need to readjust the Volume Mixer each time I restarted. To make it permanent, I adjusted volume levels within the Windows App Volume and Device Preferences.

Taken from this post:

Settings / System / Sound / App volume and device preferences

Set Console Window Host to Zero.

(You may need to hit Tab / Backspace in the console window to trigger the bell sound before the Console Window Host slider appears.)


To disable the beeps when ssh-ing in a remote machine, simply create the same ~/.inputrc and ~/.vimrc files on the remote machine to stop ssh itself from beeping.

See the answer from @Nemo for the contents of each file.


Examples related to bash

Comparing a variable with a string python not working when redirecting from bash script Zipping a file in bash fails How do I prevent Conda from activating the base environment by default? Get first line of a shell command's output Fixing a systemd service 203/EXEC failure (no such file or directory) /bin/sh: apt-get: not found VSCode Change Default Terminal Run bash command on jenkins pipeline How to check if the docker engine and a docker container are running? How to switch Python versions in Terminal?

Examples related to windows-10

Starting ssh-agent on Windows 10 fails: "unable to start ssh-agent service, error :1058" How to install OpenSSL in windows 10? Anaconda Installed but Cannot Launch Navigator Conda command is not recognized on Windows 10 Copy Files from Windows to the Ubuntu Subsystem Hyper-V: Create shared folder between host and guest with internal network Why Local Users and Groups is missing in Computer Management on Windows 10 Home? VMware Workstation and Device/Credential Guard are not compatible pip not working in Python Installation in Windows 10 Copy Paste in Bash on Ubuntu on Windows

Examples related to windows-subsystem-for-linux

System has not been booted with systemd as init system (PID 1). Can't operate Copy Files from Windows to the Ubuntu Subsystem Copy Paste in Bash on Ubuntu on Windows Disable beep of Linux Bash on Windows 10