Disable beep of Linux Bash on Windows 10 [closed]

坚强是说给别人听的谎言 提交于 2019-12-03 01:30:44

问题


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


回答1:


  1. To disable the beep in bash you need to uncomment (or add if not already there) the line set bell-style none in your /etc/inputrc file.

    Note: Since it is a protected file you need to be a privileged user to edit it (i.e. launch your text editor with something like sudo <editor> /etc/inputrc).

  2. To disable the beep also in vim you need to add set visualbell in your ~/.vimrc file.

  3. To disable the beep also in less (i.e. also in man pages and when using "git diff") you need to add export LESS="$LESS -R -Q" in your ~/.profile file.




回答2:


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




回答3:


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



回答4:


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.




回答5:


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.

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




回答6:


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




回答7:


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




回答8:


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.)




回答9:


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.




回答10:


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.




回答11:


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.




回答12:


@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.



来源:https://stackoverflow.com/questions/36724209/disable-beep-of-linux-bash-on-windows-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!