Windows Linux Subsytem shell 关闭提示音

直接使用bash shell script:

 

# 这几个不需要使用sudo
echo set visualbell >> ~/.vimrc
echo set t_vb= >> ~/.vimrc
echo export LESS=\"\$LESS -R -Q\" >> ~/.profile

# 这个得用sudo
sudo perl -pi.bak -e 's/^# set bell-style none/set bell-style none/' /etc/inputrc
#这个也可以用sed命令,
# sudo sed -i.bak 's/^# set bell-style none/set bell-style none/' /etc/inputrc

 

  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 and the visual bell also in vim you need to add the following to your ~/.vimrc file:

    set visualbell
    set t_vb=
    
  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.

 
posted @ 2025-05-23 00:17  profesor  阅读(45)  评论(0)    收藏  举报